Bug 1550903 - Part 2: Revendor dependencies. r=emilio,kats,froydnj
☠☠ backed out by 03203f118c97 ☠ ☠
authorBastien Orivel <eijebong@bananium.fr>
Wed, 15 May 2019 17:40:17 +0000
changeset 474272 d62be51ffad3d8a22ad4ebaffff910e9dd7bb6e1
parent 474271 f48939dc27b6418ffbc473cf8077f329d14f2a86
child 474273 fc0842a0b38f664b96458910cc1a2f7faf2b9858
push id113144
push usershindli@mozilla.com
push dateFri, 17 May 2019 16:44:55 +0000
treeherdermozilla-inbound@f4c4b796f845 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, kats, froydnj
bugs1550903
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550903 - Part 2: Revendor dependencies. r=emilio,kats,froydnj It was unhappy about the new LICENSE (fuchsia-cprng) but it's the same as the other fuschia crates. Since I don't think this is used at build time but has the same license as the other fuschia crates, I put it in the RUNTIME_LICENSE_PACKAGE_WHITELIST list. I also removed sha1 from that list as it's not used anymore Differential Revision: https://phabricator.services.mozilla.com/D30746
python/mozbuild/mozbuild/vendor_rust.py
third_party/rust/autocfg/.cargo-checksum.json
third_party/rust/autocfg/Cargo.toml
third_party/rust/autocfg/LICENSE-APACHE
third_party/rust/autocfg/LICENSE-MIT
third_party/rust/autocfg/README.md
third_party/rust/autocfg/examples/integers.rs
third_party/rust/autocfg/examples/paths.rs
third_party/rust/autocfg/examples/traits.rs
third_party/rust/autocfg/examples/versions.rs
third_party/rust/autocfg/src/error.rs
third_party/rust/autocfg/src/lib.rs
third_party/rust/autocfg/src/tests.rs
third_party/rust/autocfg/src/version.rs
third_party/rust/cloudabi/.cargo-checksum.json
third_party/rust/cloudabi/Cargo.toml
third_party/rust/cloudabi/bitflags.rs
third_party/rust/cloudabi/cloudabi.rs
third_party/rust/fuchsia-cprng/.cargo-checksum.json
third_party/rust/fuchsia-cprng/AUTHORS
third_party/rust/fuchsia-cprng/Cargo.toml
third_party/rust/fuchsia-cprng/LICENSE
third_party/rust/fuchsia-cprng/PATENTS
third_party/rust/fuchsia-cprng/src/lib.rs
third_party/rust/httparse/.cargo-checksum.json
third_party/rust/httparse/Cargo.toml
third_party/rust/httparse/README.md
third_party/rust/httparse/benches/parse.rs
third_party/rust/httparse/build.rs
third_party/rust/httparse/src/iter.rs
third_party/rust/httparse/src/lib.rs
third_party/rust/httparse/src/macros.rs
third_party/rust/httparse/src/simd/avx2.rs
third_party/rust/httparse/src/simd/fallback.rs
third_party/rust/httparse/src/simd/mod.rs
third_party/rust/httparse/src/simd/sse42.rs
third_party/rust/httparse/tests/uri.rs
third_party/rust/lazycell/.cargo-checksum.json
third_party/rust/lazycell/CHANGELOG.md
third_party/rust/lazycell/Cargo.toml
third_party/rust/lazycell/LICENSE-MIT
third_party/rust/lazycell/README.md
third_party/rust/lazycell/src/lib.rs
third_party/rust/mio-extras/.cargo-checksum.json
third_party/rust/mio-extras/CHANGELOG.md
third_party/rust/mio-extras/Cargo.toml
third_party/rust/mio-extras/LICENSE-APACHE
third_party/rust/mio-extras/LICENSE-MIT
third_party/rust/mio-extras/README.md
third_party/rust/mio-extras/src/channel.rs
third_party/rust/mio-extras/src/lib.rs
third_party/rust/mio-extras/src/timer.rs
third_party/rust/mio-extras/test/mod.rs
third_party/rust/mio-extras/test/test_poll_channel.rs
third_party/rust/mio-extras/test/test_timer.rs
third_party/rust/mio/.cargo-checksum.json
third_party/rust/mio/CHANGELOG.md
third_party/rust/mio/Cargo.toml
third_party/rust/mio/ci/ios/deploy_and_run_on_ios_simulator.rs
third_party/rust/mio/ci/run-ios.sh
third_party/rust/mio/src/event_imp.rs
third_party/rust/mio/src/lib.rs
third_party/rust/mio/src/poll.rs
third_party/rust/mio/src/sys/unix/epoll.rs
third_party/rust/mio/src/sys/unix/ready.rs
third_party/rust/mio/test/mod.rs
third_party/rust/mio/test/test_timer.rs
third_party/rust/rand-0.4.3/.cargo-checksum.json
third_party/rust/rand-0.4.3/CHANGELOG.md
third_party/rust/rand-0.4.3/Cargo.toml
third_party/rust/rand-0.4.3/LICENSE-APACHE
third_party/rust/rand-0.4.3/LICENSE-MIT
third_party/rust/rand-0.4.3/README.md
third_party/rust/rand-0.4.3/appveyor.yml
third_party/rust/rand-0.4.3/benches/bench.rs
third_party/rust/rand-0.4.3/benches/distributions/exponential.rs
third_party/rust/rand-0.4.3/benches/distributions/gamma.rs
third_party/rust/rand-0.4.3/benches/distributions/mod.rs
third_party/rust/rand-0.4.3/benches/distributions/normal.rs
third_party/rust/rand-0.4.3/benches/generators.rs
third_party/rust/rand-0.4.3/benches/misc.rs
third_party/rust/rand-0.4.3/src/distributions/exponential.rs
third_party/rust/rand-0.4.3/src/distributions/gamma.rs
third_party/rust/rand-0.4.3/src/distributions/mod.rs
third_party/rust/rand-0.4.3/src/distributions/normal.rs
third_party/rust/rand-0.4.3/src/distributions/range.rs
third_party/rust/rand-0.4.3/src/distributions/ziggurat_tables.rs
third_party/rust/rand-0.4.3/src/jitter.rs
third_party/rust/rand-0.4.3/src/lib.rs
third_party/rust/rand-0.4.3/src/os.rs
third_party/rust/rand-0.4.3/src/prng/chacha.rs
third_party/rust/rand-0.4.3/src/prng/isaac.rs
third_party/rust/rand-0.4.3/src/prng/isaac64.rs
third_party/rust/rand-0.4.3/src/prng/mod.rs
third_party/rust/rand-0.4.3/src/prng/xorshift.rs
third_party/rust/rand-0.4.3/src/rand_impls.rs
third_party/rust/rand-0.4.3/src/read.rs
third_party/rust/rand-0.4.3/src/reseeding.rs
third_party/rust/rand-0.4.3/src/seq.rs
third_party/rust/rand-0.4.3/utils/ziggurat_tables.py
third_party/rust/rand/.cargo-checksum.json
third_party/rust/rand/CHANGELOG.md
third_party/rust/rand/COPYRIGHT
third_party/rust/rand/Cargo.toml
third_party/rust/rand/LICENSE-APACHE
third_party/rust/rand/LICENSE-MIT
third_party/rust/rand/README.md
third_party/rust/rand/appveyor.yml
third_party/rust/rand/benches/bench.rs
third_party/rust/rand/benches/distributions.rs
third_party/rust/rand/benches/distributions/exponential.rs
third_party/rust/rand/benches/distributions/gamma.rs
third_party/rust/rand/benches/distributions/mod.rs
third_party/rust/rand/benches/distributions/normal.rs
third_party/rust/rand/benches/generators.rs
third_party/rust/rand/benches/misc.rs
third_party/rust/rand/benches/seq.rs
third_party/rust/rand/build.rs
third_party/rust/rand/examples/monte-carlo.rs
third_party/rust/rand/examples/monty-hall.rs
third_party/rust/rand/src/deprecated.rs
third_party/rust/rand/src/distributions/bernoulli.rs
third_party/rust/rand/src/distributions/binomial.rs
third_party/rust/rand/src/distributions/cauchy.rs
third_party/rust/rand/src/distributions/dirichlet.rs
third_party/rust/rand/src/distributions/exponential.rs
third_party/rust/rand/src/distributions/float.rs
third_party/rust/rand/src/distributions/gamma.rs
third_party/rust/rand/src/distributions/integer.rs
third_party/rust/rand/src/distributions/mod.rs
third_party/rust/rand/src/distributions/normal.rs
third_party/rust/rand/src/distributions/other.rs
third_party/rust/rand/src/distributions/pareto.rs
third_party/rust/rand/src/distributions/poisson.rs
third_party/rust/rand/src/distributions/range.rs
third_party/rust/rand/src/distributions/triangular.rs
third_party/rust/rand/src/distributions/uniform.rs
third_party/rust/rand/src/distributions/unit_circle.rs
third_party/rust/rand/src/distributions/unit_sphere.rs
third_party/rust/rand/src/distributions/utils.rs
third_party/rust/rand/src/distributions/weibull.rs
third_party/rust/rand/src/distributions/weighted.rs
third_party/rust/rand/src/distributions/ziggurat_tables.rs
third_party/rust/rand/src/jitter.rs
third_party/rust/rand/src/lib.rs
third_party/rust/rand/src/os.rs
third_party/rust/rand/src/prelude.rs
third_party/rust/rand/src/prng/chacha.rs
third_party/rust/rand/src/prng/isaac.rs
third_party/rust/rand/src/prng/isaac64.rs
third_party/rust/rand/src/prng/mod.rs
third_party/rust/rand/src/prng/xorshift.rs
third_party/rust/rand/src/rand_impls.rs
third_party/rust/rand/src/read.rs
third_party/rust/rand/src/reseeding.rs
third_party/rust/rand/src/rngs/adapter/mod.rs
third_party/rust/rand/src/rngs/adapter/read.rs
third_party/rust/rand/src/rngs/adapter/reseeding.rs
third_party/rust/rand/src/rngs/entropy.rs
third_party/rust/rand/src/rngs/mock.rs
third_party/rust/rand/src/rngs/mod.rs
third_party/rust/rand/src/rngs/small.rs
third_party/rust/rand/src/rngs/std.rs
third_party/rust/rand/src/rngs/thread.rs
third_party/rust/rand/src/seq.rs
third_party/rust/rand/src/seq/index.rs
third_party/rust/rand/src/seq/mod.rs
third_party/rust/rand/tests/uniformity.rs
third_party/rust/rand/utils/ziggurat_tables.py
third_party/rust/rand_chacha/.cargo-checksum.json
third_party/rust/rand_chacha/CHANGELOG.md
third_party/rust/rand_chacha/COPYRIGHT
third_party/rust/rand_chacha/Cargo.toml
third_party/rust/rand_chacha/LICENSE-APACHE
third_party/rust/rand_chacha/LICENSE-MIT
third_party/rust/rand_chacha/README.md
third_party/rust/rand_chacha/build.rs
third_party/rust/rand_chacha/src/chacha.rs
third_party/rust/rand_chacha/src/lib.rs
third_party/rust/rand_core-0.3.1/.cargo-checksum.json
third_party/rust/rand_core-0.3.1/CHANGELOG.md
third_party/rust/rand_core-0.3.1/COPYRIGHT
third_party/rust/rand_core-0.3.1/Cargo.toml
third_party/rust/rand_core-0.3.1/LICENSE-APACHE
third_party/rust/rand_core-0.3.1/LICENSE-MIT
third_party/rust/rand_core-0.3.1/README.md
third_party/rust/rand_core-0.3.1/src/block.rs
third_party/rust/rand_core-0.3.1/src/error.rs
third_party/rust/rand_core-0.3.1/src/impls.rs
third_party/rust/rand_core-0.3.1/src/le.rs
third_party/rust/rand_core-0.3.1/src/lib.rs
third_party/rust/rand_core/.cargo-checksum.json
third_party/rust/rand_core/CHANGELOG.md
third_party/rust/rand_core/COPYRIGHT
third_party/rust/rand_core/Cargo.toml
third_party/rust/rand_core/LICENSE-APACHE
third_party/rust/rand_core/LICENSE-MIT
third_party/rust/rand_core/README.md
third_party/rust/rand_core/src/block.rs
third_party/rust/rand_core/src/error.rs
third_party/rust/rand_core/src/impls.rs
third_party/rust/rand_core/src/le.rs
third_party/rust/rand_core/src/lib.rs
third_party/rust/rand_hc/.cargo-checksum.json
third_party/rust/rand_hc/CHANGELOG.md
third_party/rust/rand_hc/COPYRIGHT
third_party/rust/rand_hc/Cargo.toml
third_party/rust/rand_hc/LICENSE-APACHE
third_party/rust/rand_hc/LICENSE-MIT
third_party/rust/rand_hc/README.md
third_party/rust/rand_hc/src/hc128.rs
third_party/rust/rand_hc/src/lib.rs
third_party/rust/rand_isaac/.cargo-checksum.json
third_party/rust/rand_isaac/CHANGELOG.md
third_party/rust/rand_isaac/COPYRIGHT
third_party/rust/rand_isaac/Cargo.toml
third_party/rust/rand_isaac/LICENSE-APACHE
third_party/rust/rand_isaac/LICENSE-MIT
third_party/rust/rand_isaac/README.md
third_party/rust/rand_isaac/src/isaac.rs
third_party/rust/rand_isaac/src/isaac64.rs
third_party/rust/rand_isaac/src/isaac_array.rs
third_party/rust/rand_isaac/src/lib.rs
third_party/rust/rand_jitter/.cargo-checksum.json
third_party/rust/rand_jitter/CHANGELOG.md
third_party/rust/rand_jitter/COPYRIGHT
third_party/rust/rand_jitter/Cargo.toml
third_party/rust/rand_jitter/LICENSE-APACHE
third_party/rust/rand_jitter/LICENSE-MIT
third_party/rust/rand_jitter/README.md
third_party/rust/rand_jitter/benches/mod.rs
third_party/rust/rand_jitter/src/dummy_log.rs
third_party/rust/rand_jitter/src/error.rs
third_party/rust/rand_jitter/src/lib.rs
third_party/rust/rand_jitter/src/platform.rs
third_party/rust/rand_jitter/tests/mod.rs
third_party/rust/rand_os/.cargo-checksum.json
third_party/rust/rand_os/CHANGELOG.md
third_party/rust/rand_os/COPYRIGHT
third_party/rust/rand_os/Cargo.toml
third_party/rust/rand_os/LICENSE-APACHE
third_party/rust/rand_os/LICENSE-MIT
third_party/rust/rand_os/README.md
third_party/rust/rand_os/src/cloudabi.rs
third_party/rust/rand_os/src/dragonfly_haiku_emscripten.rs
third_party/rust/rand_os/src/dummy_log.rs
third_party/rust/rand_os/src/freebsd.rs
third_party/rust/rand_os/src/fuchsia.rs
third_party/rust/rand_os/src/lib.rs
third_party/rust/rand_os/src/linux_android.rs
third_party/rust/rand_os/src/macos.rs
third_party/rust/rand_os/src/netbsd.rs
third_party/rust/rand_os/src/openbsd_bitrig.rs
third_party/rust/rand_os/src/random_device.rs
third_party/rust/rand_os/src/redox.rs
third_party/rust/rand_os/src/sgx.rs
third_party/rust/rand_os/src/solarish.rs
third_party/rust/rand_os/src/wasm32_bindgen.rs
third_party/rust/rand_os/src/wasm32_stdweb.rs
third_party/rust/rand_os/src/windows.rs
third_party/rust/rand_os/tests/mod.rs
third_party/rust/rand_pcg/.cargo-checksum.json
third_party/rust/rand_pcg/CHANGELOG.md
third_party/rust/rand_pcg/COPYRIGHT
third_party/rust/rand_pcg/Cargo.toml
third_party/rust/rand_pcg/LICENSE-APACHE
third_party/rust/rand_pcg/LICENSE-MIT
third_party/rust/rand_pcg/README.md
third_party/rust/rand_pcg/build.rs
third_party/rust/rand_pcg/src/lib.rs
third_party/rust/rand_pcg/src/pcg128.rs
third_party/rust/rand_pcg/src/pcg64.rs
third_party/rust/rand_pcg/tests/lcg64xsh32.rs
third_party/rust/rand_pcg/tests/mcg128xsl64.rs
third_party/rust/rand_xorshift/.cargo-checksum.json
third_party/rust/rand_xorshift/CHANGELOG.md
third_party/rust/rand_xorshift/COPYRIGHT
third_party/rust/rand_xorshift/Cargo.toml
third_party/rust/rand_xorshift/LICENSE-APACHE
third_party/rust/rand_xorshift/LICENSE-MIT
third_party/rust/rand_xorshift/README.md
third_party/rust/rand_xorshift/src/lib.rs
third_party/rust/rand_xorshift/tests/mod.rs
third_party/rust/rdrand/.cargo-checksum.json
third_party/rust/rdrand/Cargo.toml
third_party/rust/rdrand/LICENSE
third_party/rust/rdrand/README.mkd
third_party/rust/rdrand/appveyor.yml
third_party/rust/rdrand/benches/rdrand.rs
third_party/rust/rdrand/benches/rdseed.rs
third_party/rust/rdrand/benches/std.rs
third_party/rust/rdrand/src/changelog.rs
third_party/rust/rdrand/src/lib.rs
third_party/rust/sha-1/.cargo-checksum.json
third_party/rust/sha-1/Cargo.toml
third_party/rust/sha-1/LICENSE-APACHE
third_party/rust/sha-1/LICENSE-MIT
third_party/rust/sha-1/benches/lib.rs
third_party/rust/sha-1/examples/sha1sum.rs
third_party/rust/sha-1/src/consts.rs
third_party/rust/sha-1/src/lib.rs
third_party/rust/sha-1/src/utils.rs
third_party/rust/sha-1/tests/data/one_million_a.bin
third_party/rust/sha-1/tests/data/sha1.blb
third_party/rust/sha-1/tests/lib.rs
third_party/rust/sha1/.cargo-checksum.json
third_party/rust/sha1/Cargo.toml
third_party/rust/sha1/LICENSE
third_party/rust/sha1/README.md
third_party/rust/sha1/src/lib.rs
third_party/rust/ws/.cargo-checksum.json
third_party/rust/ws/CHANGELOG.md
third_party/rust/ws/Cargo.toml
third_party/rust/ws/README.md
third_party/rust/ws/examples/autobahn-client.rs
third_party/rust/ws/examples/autobahn-server.rs
third_party/rust/ws/examples/bench-server.rs
third_party/rust/ws/examples/bench.rs
third_party/rust/ws/examples/channel.rs
third_party/rust/ws/examples/cli.rs
third_party/rust/ws/examples/client.rs
third_party/rust/ws/examples/external_shutdown.rs
third_party/rust/ws/examples/html_chat.rs
third_party/rust/ws/examples/peer2peer.rs
third_party/rust/ws/examples/pong.rs
third_party/rust/ws/examples/remote_addr.rs
third_party/rust/ws/examples/router.rs
third_party/rust/ws/examples/server.rs
third_party/rust/ws/examples/shared.rs
third_party/rust/ws/examples/ssl-server.rs
third_party/rust/ws/examples/threaded.rs
third_party/rust/ws/examples/unsafe-ssl-client.rs
third_party/rust/ws/src/communication.rs
third_party/rust/ws/src/connection.rs
third_party/rust/ws/src/deflate/context.rs
third_party/rust/ws/src/deflate/extension.rs
third_party/rust/ws/src/deflate/mod.rs
third_party/rust/ws/src/factory.rs
third_party/rust/ws/src/frame.rs
third_party/rust/ws/src/handler.rs
third_party/rust/ws/src/handshake.rs
third_party/rust/ws/src/io.rs
third_party/rust/ws/src/lib.rs
third_party/rust/ws/src/message.rs
third_party/rust/ws/src/protocol.rs
third_party/rust/ws/src/result.rs
third_party/rust/ws/src/stream.rs
third_party/rust/ws/src/util.rs
third_party/rust/ws/tests/deflate.rs
third_party/rust/ws/tests/shutdown.rs
toolkit/content/license.html
--- a/python/mozbuild/mozbuild/vendor_rust.py
+++ b/python/mozbuild/mozbuild/vendor_rust.py
@@ -169,24 +169,24 @@ Please commit or stash these changes bef
     # Licenses for code used at build time (e.g. code generators). Please see the above
     # comments before adding anything to this list.
     BUILDTIME_LICENSE_WHITELIST = {
         'BSD-3-Clause': [
             'adler32',
             'bindgen',
             'fuchsia-zircon',
             'fuchsia-zircon-sys',
+            'fuchsia-cprng',
         ]
     }
 
     # This whitelist should only be used for packages that use an acceptable
     # license, but that also need to explicitly mentioned in about:license.
     RUNTIME_LICENSE_PACKAGE_WHITELIST = {
         'BSD-3-Clause': [
-            'sha1',
         ]
     }
 
     # This whitelist should only be used for packages that use a
     # license-file and for which the license-file entry has been
     # reviewed.  The table is keyed by package names and maps to the
     # sha256 hash of the license file that we reviewed.
     #
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{"Cargo.toml":"59b541962c15f51087a11d7296e3b69ec6d9b8a8e9e8db949e7629ea28183564","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"27995d58ad5c1145c1a8cd86244ce844886958a35eb2b78c6b772748669999ac","README.md":"d0e320dccace525a2cbcf3bc5d43ac9b7b61ee86b9c9713bf68993c3ad789d0a","examples/integers.rs":"589ff4271566dfa322becddf3e2c7b592e6e0bc97b02892ce75619b7e452e930","examples/paths.rs":"1b30e466b824ce8df7ad0a55334424131d9d2573d6cf9f7d5d50c09c8901d526","examples/traits.rs":"cbee6a3e1f7db60b02ae25b714926517144a77cb492021f492774cf0e1865a9e","examples/versions.rs":"38535e6d9f5bfae0de474a3db79a40e8f5da8ba9334c5ff4c363de9bc99d4d12","src/error.rs":"12de7dafea4a35d1dc2f0fa79bfa038386bbbea72bf083979f4ddf227999eeda","src/lib.rs":"7392068683dc86107bcf8073c81ff8fb7026f5fb98a355a4d47301c5946eeccb","src/tests.rs":"34bdceeffdbdd7f2535a6ed8272482b17325dba044c91bb96f3f8caeec58a83d","src/version.rs":"165324950f2195aaf068c47a4f2f0992b2bf18d8b7f4f17b6b264767523c0e5d"},"package":"a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"}
\ No newline at end of file
copy from third_party/rust/httparse/Cargo.toml
copy to third_party/rust/autocfg/Cargo.toml
--- a/third_party/rust/httparse/Cargo.toml
+++ b/third_party/rust/autocfg/Cargo.toml
@@ -6,24 +6,19 @@
 # to registry (e.g. crates.io) dependencies
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
-name = "httparse"
-version = "1.2.3"
-authors = ["Sean McArthur <sean.monstar@gmail.com>"]
-description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
-license = "MIT/Apache-2.0"
-repository = "https://github.com/seanmonstar/httparse"
-[profile.bench]
-opt-level = 3
-lto = true
-codegen-units = 1
-[dev-dependencies.pico-sys]
-version = "0.0"
+name = "autocfg"
+version = "0.1.2"
+authors = ["Josh Stone <cuviper@gmail.com>"]
+description = "Automatic cfg for Rust compiler features"
+readme = "README.md"
+keywords = ["rustc", "build", "autoconf"]
+categories = ["development-tools::build-utils"]
+license = "Apache-2.0/MIT"
+repository = "https://github.com/cuviper/autocfg"
 
-[features]
-default = ["std"]
-std = []
+[dependencies]
copy from third_party/rust/rand/LICENSE-APACHE
copy to third_party/rust/autocfg/LICENSE-APACHE
copy from third_party/rust/rand/LICENSE-MIT
copy to third_party/rust/autocfg/LICENSE-MIT
--- a/third_party/rust/rand/LICENSE-MIT
+++ b/third_party/rust/autocfg/LICENSE-MIT
@@ -1,9 +1,9 @@
-Copyright (c) 2014 The Rust Project Developers
+Copyright (c) 2018 Josh Stone
 
 Permission is hereby granted, free of charge, to any
 person obtaining a copy of this software and associated
 documentation files (the "Software"), to deal in the
 Software without restriction, including without
 limitation the rights to use, copy, modify, merge,
 publish, distribute, sublicense, and/or sell copies of
 the Software, and to permit persons to whom the Software
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/README.md
@@ -0,0 +1,68 @@
+autocfg
+=======
+
+[![autocfg crate](https://img.shields.io/crates/v/autocfg.svg)](https://crates.io/crates/autocfg)
+[![autocfg documentation](https://docs.rs/autocfg/badge.svg)](https://docs.rs/autocfg)
+![minimum rustc 1.0](https://img.shields.io/badge/rustc-1.0+-red.svg)
+[![Travis Status](https://travis-ci.org/cuviper/autocfg.svg?branch=master)](https://travis-ci.org/cuviper/autocfg)
+
+A Rust library for build scripts to automatically configure code based on
+compiler support.  Code snippets are dynamically tested to see if the `rustc`
+will accept them, rather than hard-coding specific version support.
+
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[build-dependencies]
+autocfg = "0.1"
+```
+
+Then use it in your `build.rs` script to detect compiler features.  For
+example, to test for 128-bit integer support, it might look like:
+
+```rust
+extern crate autocfg;
+
+fn main() {
+    let ac = autocfg::new();
+    ac.emit_has_type("i128");
+
+    // (optional) We don't need to rerun for anything external.
+    autocfg::rerun_path(file!());
+}
+```
+
+If the type test succeeds, this will write a `cargo:rustc-cfg=has_i128` line
+for Cargo, which translates to Rust arguments `--cfg has_i128`.  Then in the
+rest of your Rust code, you can add `#[cfg(has_i128)]` conditions on code that
+should only be used when the compiler supports it.
+
+
+## Release Notes
+
+- 0.1.2 (2018-01-16)
+  - Add `rerun_env(ENV)` to print `cargo:rerun-if-env-changed=ENV`
+  - Add `rerun_path(PATH)` to print `cargo:rerun-if-changed=PATH`
+
+
+## Minimum Rust version policy
+
+This crate's minimum supported `rustc` version is `1.0.0`.  Compatibility is
+its entire reason for existence, so this crate will be extremely conservative
+about raising this requirement.  If this is ever deemed necessary, it will be
+treated as a major breaking change for semver purposes.
+
+
+## License
+
+This project is licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
+   http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or
+   http://opensource.org/licenses/MIT)
+
+at your option.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/examples/integers.rs
@@ -0,0 +1,9 @@
+extern crate autocfg;
+
+fn main() {
+    // Normally, cargo will set `OUT_DIR` for build scripts.
+    let ac = autocfg::AutoCfg::with_dir("target").unwrap();
+    for i in 3..8 {
+        ac.emit_has_type(&format!("i{}", 1 << i));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/examples/paths.rs
@@ -0,0 +1,22 @@
+extern crate autocfg;
+
+fn main() {
+    // Normally, cargo will set `OUT_DIR` for build scripts.
+    let ac = autocfg::AutoCfg::with_dir("target").unwrap();
+
+    // since ancient times...
+    ac.emit_has_path("std::vec::Vec");
+    ac.emit_path_cfg("std::vec::Vec", "has_vec");
+
+    // rustc 1.10.0
+    ac.emit_has_path("std::panic::PanicInfo");
+    ac.emit_path_cfg("std::panic::PanicInfo", "has_panic_info");
+
+    // rustc 1.20.0
+    ac.emit_has_path("std::mem::ManuallyDrop");
+    ac.emit_path_cfg("std::mem::ManuallyDrop", "has_manually_drop");
+
+    // rustc 1.25.0
+    ac.emit_has_path("std::ptr::NonNull");
+    ac.emit_path_cfg("std::ptr::NonNull", "has_non_null");
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/examples/traits.rs
@@ -0,0 +1,26 @@
+extern crate autocfg;
+
+fn main() {
+    // Normally, cargo will set `OUT_DIR` for build scripts.
+    let ac = autocfg::AutoCfg::with_dir("target").unwrap();
+
+    // since ancient times...
+    ac.emit_has_trait("std::ops::Add");
+    ac.emit_trait_cfg("std::ops::Add", "has_ops");
+
+    // trait parameters have to be provided
+    ac.emit_has_trait("std::borrow::Borrow<str>");
+    ac.emit_trait_cfg("std::borrow::Borrow<str>", "has_borrow");
+
+    // rustc 1.8.0
+    ac.emit_has_trait("std::ops::AddAssign");
+    ac.emit_trait_cfg("std::ops::AddAssign", "has_assign_ops");
+
+    // rustc 1.12.0
+    ac.emit_has_trait("std::iter::Sum");
+    ac.emit_trait_cfg("std::iter::Sum", "has_sum");
+
+    // rustc 1.28.0
+    ac.emit_has_trait("std::alloc::GlobalAlloc");
+    ac.emit_trait_cfg("std::alloc::GlobalAlloc", "has_global_alloc");
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/examples/versions.rs
@@ -0,0 +1,9 @@
+extern crate autocfg;
+
+fn main() {
+    // Normally, cargo will set `OUT_DIR` for build scripts.
+    let ac = autocfg::AutoCfg::with_dir("target").unwrap();
+    for i in 0..100 {
+        ac.emit_rustc_version(1, i);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/src/error.rs
@@ -0,0 +1,69 @@
+use std::error;
+use std::fmt;
+use std::io;
+use std::num;
+use std::str;
+
+/// A common error type for the `autocfg` crate.
+#[derive(Debug)]
+pub struct Error {
+    kind: ErrorKind,
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        "AutoCfg error"
+    }
+
+    fn cause(&self) -> Option<&error::Error> {
+        match self.kind {
+            ErrorKind::Io(ref e) => Some(e),
+            ErrorKind::Num(ref e) => Some(e),
+            ErrorKind::Utf8(ref e) => Some(e),
+            ErrorKind::Other(_) => None,
+        }
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        match self.kind {
+            ErrorKind::Io(ref e) => e.fmt(f),
+            ErrorKind::Num(ref e) => e.fmt(f),
+            ErrorKind::Utf8(ref e) => e.fmt(f),
+            ErrorKind::Other(s) => s.fmt(f),
+        }
+    }
+}
+
+#[derive(Debug)]
+enum ErrorKind {
+    Io(io::Error),
+    Num(num::ParseIntError),
+    Utf8(str::Utf8Error),
+    Other(&'static str),
+}
+
+pub fn from_io(e: io::Error) -> Error {
+    Error {
+        kind: ErrorKind::Io(e),
+    }
+}
+
+pub fn from_num(e: num::ParseIntError) -> Error {
+    Error {
+        kind: ErrorKind::Num(e),
+    }
+}
+
+pub fn from_utf8(e: str::Utf8Error) -> Error {
+    Error {
+        kind: ErrorKind::Utf8(e),
+    }
+}
+
+pub fn from_str(s: &'static str) -> Error {
+    Error {
+        kind: ErrorKind::Other(s),
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/src/lib.rs
@@ -0,0 +1,288 @@
+//! A Rust library for build scripts to automatically configure code based on
+//! compiler support.  Code snippets are dynamically tested to see if the `rustc`
+//! will accept them, rather than hard-coding specific version support.
+//!
+//!
+//! ## Usage
+//!
+//! Add this to your `Cargo.toml`:
+//!
+//! ```toml
+//! [build-dependencies]
+//! autocfg = "0.1"
+//! ```
+//!
+//! Then use it in your `build.rs` script to detect compiler features.  For
+//! example, to test for 128-bit integer support, it might look like:
+//!
+//! ```rust
+//! extern crate autocfg;
+//!
+//! fn main() {
+//! #   // Normally, cargo will set `OUT_DIR` for build scripts.
+//! #   std::env::set_var("OUT_DIR", "target");
+//!     let ac = autocfg::new();
+//!     ac.emit_has_type("i128");
+//!
+//!     // (optional) We don't need to rerun for anything external.
+//!     autocfg::rerun_path(file!());
+//! }
+//! ```
+//!
+//! If the type test succeeds, this will write a `cargo:rustc-cfg=has_i128` line
+//! for Cargo, which translates to Rust arguments `--cfg has_i128`.  Then in the
+//! rest of your Rust code, you can add `#[cfg(has_i128)]` conditions on code that
+//! should only be used when the compiler supports it.
+
+#![deny(missing_debug_implementations)]
+#![deny(missing_docs)]
+
+use std::env;
+use std::ffi::OsString;
+use std::fs;
+use std::io::Write;
+use std::path::PathBuf;
+use std::process::{Command, Stdio};
+
+mod error;
+pub use error::Error;
+
+mod version;
+use version::Version;
+
+#[cfg(test)]
+mod tests;
+
+/// Helper to detect compiler features for `cfg` output in build scripts.
+#[derive(Clone, Debug)]
+pub struct AutoCfg {
+    out_dir: PathBuf,
+    rustc: PathBuf,
+    rustc_version: Version,
+    target: Option<OsString>,
+}
+
+/// Writes a config flag for rustc on standard out.
+///
+/// This looks like: `cargo:rustc-cfg=CFG`
+///
+/// Cargo will use this in arguments to rustc, like `--cfg CFG`.
+pub fn emit(cfg: &str) {
+    println!("cargo:rustc-cfg={}", cfg);
+}
+
+/// Writes a line telling Cargo to rerun the build script if `path` changes.
+///
+/// This looks like: `cargo:rerun-if-changed=PATH`
+///
+/// This requires at least cargo 0.7.0, corresponding to rustc 1.6.0.  Earlier
+/// versions of cargo will simply ignore the directive.
+pub fn rerun_path(path: &str) {
+    println!("cargo:rerun-if-changed={}", path);
+}
+
+/// Writes a line telling Cargo to rerun the build script if the environment
+/// variable `var` changes.
+///
+/// This looks like: `cargo:rerun-if-env-changed=VAR`
+///
+/// This requires at least cargo 0.21.0, corresponding to rustc 1.20.0.  Earlier
+/// versions of cargo will simply ignore the directive.
+pub fn rerun_env(var: &str) {
+    println!("cargo:rerun-if-env-changed={}", var);
+}
+
+/// Create a new `AutoCfg` instance.
+///
+/// # Panics
+///
+/// Panics if `AutoCfg::new()` returns an error.
+pub fn new() -> AutoCfg {
+    AutoCfg::new().unwrap()
+}
+
+impl AutoCfg {
+    /// Create a new `AutoCfg` instance.
+    ///
+    /// # Common errors
+    ///
+    /// - `rustc` can't be executed, from `RUSTC` or in the `PATH`.
+    /// - The version output from `rustc` can't be parsed.
+    /// - `OUT_DIR` is not set in the environment, or is not a writable directory.
+    ///
+    pub fn new() -> Result<Self, Error> {
+        match env::var_os("OUT_DIR") {
+            Some(d) => Self::with_dir(d),
+            None => Err(error::from_str("no OUT_DIR specified!")),
+        }
+    }
+
+    /// Create a new `AutoCfg` instance with the specified output directory.
+    ///
+    /// # Common errors
+    ///
+    /// - `rustc` can't be executed, from `RUSTC` or in the `PATH`.
+    /// - The version output from `rustc` can't be parsed.
+    /// - `dir` is not a writable directory.
+    ///
+    pub fn with_dir<T: Into<PathBuf>>(dir: T) -> Result<Self, Error> {
+        let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into());
+        let rustc: PathBuf = rustc.into();
+        let rustc_version = try!(Version::from_rustc(&rustc));
+
+        // Sanity check the output directory
+        let dir = dir.into();
+        let meta = try!(fs::metadata(&dir).map_err(error::from_io));
+        if !meta.is_dir() || meta.permissions().readonly() {
+            return Err(error::from_str("output path is not a writable directory"));
+        }
+
+        Ok(AutoCfg {
+            out_dir: dir,
+            rustc: rustc,
+            rustc_version: rustc_version,
+            target: env::var_os("TARGET"),
+        })
+    }
+
+    /// Test whether the current `rustc` reports a version greater than
+    /// or equal to "`major`.`minor`".
+    pub fn probe_rustc_version(&self, major: usize, minor: usize) -> bool {
+        self.rustc_version >= Version::new(major, minor, 0)
+    }
+
+    /// Sets a `cfg` value of the form `rustc_major_minor`, like `rustc_1_29`,
+    /// if the current `rustc` is at least that version.
+    pub fn emit_rustc_version(&self, major: usize, minor: usize) {
+        if self.probe_rustc_version(major, minor) {
+            emit(&format!("rustc_{}_{}", major, minor));
+        }
+    }
+
+    fn probe<T: AsRef<[u8]>>(&self, code: T) -> Result<bool, Error> {
+        use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+
+        static ID: AtomicUsize = ATOMIC_USIZE_INIT;
+
+        let id = ID.fetch_add(1, Ordering::Relaxed);
+        let mut command = Command::new(&self.rustc);
+        command
+            .arg(format!("--crate-name=probe{}", id))
+            .arg("--crate-type=lib")
+            .arg("--out-dir")
+            .arg(&self.out_dir)
+            .arg("--emit=llvm-ir");
+
+        if let Some(target) = self.target.as_ref() {
+            command.arg("--target").arg(target);
+        }
+
+        command.arg("-").stdin(Stdio::piped());
+        let mut child = try!(command.spawn().map_err(error::from_io));
+        try!(
+            child
+                .stdin
+                .take()
+                .expect("rustc stdin")
+                .write_all(code.as_ref())
+                .map_err(error::from_io)
+        );
+
+        let status = try!(child.wait().map_err(error::from_io));
+        Ok(status.success())
+    }
+
+    /// Tests whether the given path can be used.
+    ///
+    /// The test code is subject to change, but currently looks like:
+    ///
+    /// ```ignore
+    /// pub use PATH;
+    /// ```
+    pub fn probe_path(&self, path: &str) -> bool {
+        self.probe(format!("pub use {};", path)).unwrap_or(false)
+    }
+
+    /// Emits a config value `has_PATH` if `probe_path` returns true.
+    ///
+    /// Any non-identifier characters in the `path` will be replaced with
+    /// `_` in the generated config value.
+    pub fn emit_has_path(&self, path: &str) {
+        if self.probe_path(path) {
+            emit(&format!("has_{}", mangle(path)));
+        }
+    }
+
+    /// Emits the given `cfg` value if `probe_path` returns true.
+    pub fn emit_path_cfg(&self, path: &str, cfg: &str) {
+        if self.probe_path(path) {
+            emit(cfg);
+        }
+    }
+
+    /// Tests whether the given trait can be used.
+    ///
+    /// The test code is subject to change, but currently looks like:
+    ///
+    /// ```ignore
+    /// pub trait Probe: TRAIT + Sized {}
+    /// ```
+    pub fn probe_trait(&self, name: &str) -> bool {
+        self.probe(format!("pub trait Probe: {} + Sized {{}}", name))
+            .unwrap_or(false)
+    }
+
+    /// Emits a config value `has_TRAIT` if `probe_trait` returns true.
+    ///
+    /// Any non-identifier characters in the trait `name` will be replaced with
+    /// `_` in the generated config value.
+    pub fn emit_has_trait(&self, name: &str) {
+        if self.probe_trait(name) {
+            emit(&format!("has_{}", mangle(name)));
+        }
+    }
+
+    /// Emits the given `cfg` value if `probe_trait` returns true.
+    pub fn emit_trait_cfg(&self, name: &str, cfg: &str) {
+        if self.probe_trait(name) {
+            emit(cfg);
+        }
+    }
+
+    /// Tests whether the given type can be used.
+    ///
+    /// The test code is subject to change, but currently looks like:
+    ///
+    /// ```ignore
+    /// pub type Probe = TYPE;
+    /// ```
+    pub fn probe_type(&self, name: &str) -> bool {
+        self.probe(format!("pub type Probe = {};", name))
+            .unwrap_or(false)
+    }
+
+    /// Emits a config value `has_TYPE` if `probe_type` returns true.
+    ///
+    /// Any non-identifier characters in the type `name` will be replaced with
+    /// `_` in the generated config value.
+    pub fn emit_has_type(&self, name: &str) {
+        if self.probe_type(name) {
+            emit(&format!("has_{}", mangle(name)));
+        }
+    }
+
+    /// Emits the given `cfg` value if `probe_type` returns true.
+    pub fn emit_type_cfg(&self, name: &str, cfg: &str) {
+        if self.probe_type(name) {
+            emit(cfg);
+        }
+    }
+}
+
+fn mangle(s: &str) -> String {
+    s.chars()
+        .map(|c| match c {
+            'A'...'Z' | 'a'...'z' | '0'...'9' => c,
+            _ => '_',
+        }).collect()
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/src/tests.rs
@@ -0,0 +1,57 @@
+use super::AutoCfg;
+
+#[test]
+fn autocfg_version() {
+    let ac = AutoCfg::with_dir("target").unwrap();
+    println!("version: {:?}", ac.rustc_version);
+    assert!(ac.probe_rustc_version(1, 0));
+}
+
+#[test]
+fn version_cmp() {
+    use super::version::Version;
+    let v123 = Version::new(1, 2, 3);
+
+    assert!(Version::new(1, 0, 0) < v123);
+    assert!(Version::new(1, 2, 2) < v123);
+    assert!(Version::new(1, 2, 3) == v123);
+    assert!(Version::new(1, 2, 4) > v123);
+    assert!(Version::new(1, 10, 0) > v123);
+    assert!(Version::new(2, 0, 0) > v123);
+}
+
+#[test]
+fn probe_add() {
+    let ac = AutoCfg::with_dir("target").unwrap();
+    assert!(ac.probe_path("std::ops::Add"));
+    assert!(ac.probe_trait("std::ops::Add"));
+    assert!(ac.probe_trait("std::ops::Add<i32>"));
+    assert!(ac.probe_trait("std::ops::Add<i32, Output = i32>"));
+    assert!(ac.probe_type("std::ops::Add<i32, Output = i32>"));
+}
+
+#[test]
+fn probe_as_ref() {
+    let ac = AutoCfg::with_dir("target").unwrap();
+    assert!(ac.probe_path("std::convert::AsRef"));
+    assert!(ac.probe_trait("std::convert::AsRef<str>"));
+    assert!(ac.probe_type("std::convert::AsRef<str>"));
+}
+
+#[test]
+fn probe_i128() {
+    let ac = AutoCfg::with_dir("target").unwrap();
+    let missing = !ac.probe_rustc_version(1, 26);
+    assert!(missing ^ ac.probe_path("std::i128"));
+    assert!(missing ^ ac.probe_type("i128"));
+}
+
+#[test]
+fn probe_sum() {
+    let ac = AutoCfg::with_dir("target").unwrap();
+    let missing = !ac.probe_rustc_version(1, 12);
+    assert!(missing ^ ac.probe_path("std::iter::Sum"));
+    assert!(missing ^ ac.probe_trait("std::iter::Sum"));
+    assert!(missing ^ ac.probe_trait("std::iter::Sum<i32>"));
+    assert!(missing ^ ac.probe_type("std::iter::Sum<i32>"));
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/autocfg/src/version.rs
@@ -0,0 +1,62 @@
+use std::path::Path;
+use std::process::Command;
+use std::str;
+
+use super::{error, Error};
+
+/// A version structure for making relative comparisons.
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
+pub struct Version {
+    major: usize,
+    minor: usize,
+    patch: usize,
+}
+
+impl Version {
+    /// Creates a `Version` instance for a specific `major.minor.patch` version.
+    pub fn new(major: usize, minor: usize, patch: usize) -> Self {
+        Version {
+            major: major,
+            minor: minor,
+            patch: patch,
+        }
+    }
+
+    pub fn from_rustc(rustc: &Path) -> Result<Self, Error> {
+        // Get rustc's verbose version
+        let output = try!(
+            Command::new(rustc)
+                .args(&["--version", "--verbose"])
+                .output()
+                .map_err(error::from_io)
+        );
+        if !output.status.success() {
+            return Err(error::from_str("could not execute rustc"));
+        }
+        let output = try!(str::from_utf8(&output.stdout).map_err(error::from_utf8));
+
+        // Find the release line in the verbose version output.
+        let release = match output.lines().find(|line| line.starts_with("release: ")) {
+            Some(line) => &line["release: ".len()..],
+            None => return Err(error::from_str("could not find rustc release")),
+        };
+
+        // Strip off any extra channel info, e.g. "-beta.N", "-nightly"
+        let version = match release.find('-') {
+            Some(i) => &release[..i],
+            None => release,
+        };
+
+        // Split the version into semver components.
+        let mut iter = version.splitn(3, '.');
+        let major = try!(iter.next().ok_or(error::from_str("missing major version")));
+        let minor = try!(iter.next().ok_or(error::from_str("missing minor version")));
+        let patch = try!(iter.next().ok_or(error::from_str("missing patch version")));
+
+        Ok(Version::new(
+            try!(major.parse().map_err(error::from_num)),
+            try!(minor.parse().map_err(error::from_num)),
+            try!(patch.parse().map_err(error::from_num)),
+        ))
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cloudabi/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{"Cargo.toml":"16ef935056e2aaf48b28c1340a63cc75febaabc901c752da9a3a2edbe081b429","bitflags.rs":"4621173dcf1307094cf240d26955b6f25c2f770dfd4e975ec2728771209006b5","cloudabi.rs":"93e139ba72a04db4934b04a6f21b054757a218a687e0bd2f6ba32514ec8c5f38"},"package":"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"}
\ No newline at end of file
copy from third_party/rust/httparse/Cargo.toml
copy to third_party/rust/cloudabi/Cargo.toml
--- a/third_party/rust/httparse/Cargo.toml
+++ b/third_party/rust/cloudabi/Cargo.toml
@@ -6,24 +6,26 @@
 # to registry (e.g. crates.io) dependencies
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
-name = "httparse"
-version = "1.2.3"
-authors = ["Sean McArthur <sean.monstar@gmail.com>"]
-description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
-license = "MIT/Apache-2.0"
-repository = "https://github.com/seanmonstar/httparse"
-[profile.bench]
-opt-level = 3
-lto = true
-codegen-units = 1
-[dev-dependencies.pico-sys]
-version = "0.0"
+name = "cloudabi"
+version = "0.0.3"
+authors = ["Nuxi (https://nuxi.nl/) and contributors"]
+description = "Low level interface to CloudABI. Contains all syscalls and related types."
+homepage = "https://nuxi.nl/cloudabi/"
+documentation = "https://docs.rs/cloudabi/"
+keywords = ["cloudabi"]
+license = "BSD-2-Clause"
+repository = "https://github.com/nuxinl/cloudabi"
+
+[lib]
+path = "cloudabi.rs"
+[dependencies.bitflags]
+version = "1.0"
+optional = true
 
 [features]
-default = ["std"]
-std = []
+default = ["bitflags"]
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cloudabi/bitflags.rs
@@ -0,0 +1,51 @@
+// Copyright (c) 2018 Nuxi (https://nuxi.nl/) and contributors.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+
+// Appease Rust's tidy.
+// ignore-license
+
+#[cfg(feature = "bitflags")]
+#[macro_use]
+extern crate bitflags;
+
+// Minimal implementation of bitflags! in case we can't depend on the bitflags
+// crate. Only implements `bits()` and a `from_bits_truncate()` that doesn't
+// actually truncate.
+#[cfg(not(feature = "bitflags"))]
+macro_rules! bitflags {
+  (
+    $(#[$attr:meta])*
+    pub struct $name:ident: $type:ty {
+      $($(#[$const_attr:meta])* const $const:ident = $val:expr;)*
+    }
+  ) => {
+    $(#[$attr])*
+    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+    pub struct $name { bits: $type }
+    impl $name {
+      $($(#[$const_attr])* pub const $const: $name = $name{ bits: $val };)*
+      pub fn bits(&self) -> $type { self.bits }
+      pub fn from_bits_truncate(bits: $type) -> Self { $name{ bits } }
+    }
+  }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cloudabi/cloudabi.rs
@@ -0,0 +1,2847 @@
+// Copyright (c) 2016-2017 Nuxi (https://nuxi.nl/) and contributors.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// This file is automatically generated. Do not edit.
+//
+// Source: https://github.com/NuxiNL/cloudabi
+
+// Appease Rust's tidy.
+// ignore-license
+// ignore-tidy-linelength
+
+//! **PLEASE NOTE: This entire crate including this
+//! documentation is automatically generated from
+//! [`cloudabi.txt`](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt)**
+//!
+//! # Nuxi CloudABI
+//!
+//! CloudABI is what you get if you take POSIX, add capability-based
+//! security, and remove everything that's incompatible with that. The
+//! result is a minimal ABI consisting of only 49 syscalls.
+//!
+//! CloudABI doesn't have its own kernel, but instead is implemented in existing
+//! kernels: FreeBSD has CloudABI support for x86-64 and arm64, and [a patch-set
+//! for NetBSD](https://github.com/NuxiNL/netbsd) and [a patch-set for
+//! Linux](https://github.com/NuxiNL/linux) are available as well. This means that
+//! CloudABI binaries can be executed on different operating systems, without any
+//! modification.
+//!
+//! ## Capability-Based Security
+//!
+//! Capability-based security means that processes can only perform
+//! actions that have no global impact. Processes cannot open files by
+//! their absolute path, cannot open network connections, and cannot
+//! observe global system state such as the process table.
+//!
+//! The capabilities of a process are fully determined by its set of open
+//! file descriptors (fds). For example, files can only be opened if the
+//! process already has a file descriptor to a directory the file is in.
+//!
+//! Unlike in POSIX, where processes are normally started with file
+//! descriptors 0, 1, and 2 reserved for standard input, output, and
+//! error, CloudABI does not reserve any file descriptor numbers for
+//! specific purposes.
+//!
+//! In CloudABI, a process depends on its parent process to launch it with
+//! the right set of resources, since the process will not be able to open
+//! any new resources. For example, a simple static web server would need
+//! to be started with a file descriptor to a [TCP
+//! listener](https://github.com/NuxiNL/flower), and a file descriptor to
+//! the directory for which to serve files. The web server will then be
+//! unable to do anything other than reading files in that directory, and
+//! process incoming network connections.
+//!
+//! So, unknown CloudABI binaries can safely be executed without the need
+//! for containers, virtual machines, or other sandboxing technologies.
+//!
+//! Watch [Ed Schouten's Talk at
+//! 32C3](https://www.youtube.com/watch?v=3N29vrPoDv8) for more
+//! information about what capability-based security for UNIX means.
+//!
+//! ## Cloudlibc
+//!
+//! [Cloudlibc](https://github.com/NuxiNL/cloudlibc) is an implementation
+//! of the C standard library, without all CloudABI-incompatible
+//! functions. For example, Cloudlibc does not have `printf`, but does
+//! have `fprintf`. It does not have `open`, but does have `openat`.
+//!
+//! ## CloudABI-Ports
+//!
+//! [CloudABI-Ports](https://github.com/NuxiNL/cloudabi-ports) is a
+//! collection of ports of commonly used libraries and applications to
+//! CloudABI. It contains software such as `zlib`, `libpng`, `boost`,
+//! `memcached`, and much more. The software is patched to not depend on
+//! any global state, such as files in `/etc` or `/dev`, using `open()`,
+//! etc.
+//!
+//! ## Using CloudABI
+//!
+//! Instructions for using CloudABI (including kernel modules/patches,
+//! toolchain, and ports) are available for several operating systems:
+//!
+//! - [Arch Linux](https://nuxi.nl/cloudabi/archlinux/)
+//! - [Debian, Ubuntu, and other Debian derivatives](https://nuxi.nl/cloudabi/debian/)
+//! - [FreeBSD, PC-BSD and DragonFly BSD](https://nuxi.nl/cloudabi/freebsd/)
+//! - [Mac OS X](https://nuxi.nl/cloudabi/mac/)
+//! - [NetBSD](https://nuxi.nl/cloudabi/netbsd/)
+//!
+//! ## Specification of the ABI
+//!
+//! The entire ABI is specified in a a file called
+//! [`cloudabi.txt`](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt),
+//! from which all
+//! [headers](https://github.com/NuxiNL/cloudabi/tree/master/headers)
+//! and documentation (including the one you're reading now) is generated.
+
+#![no_std]
+#![allow(non_camel_case_types)]
+
+include!("bitflags.rs");
+
+/// File or memory access pattern advisory information.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum advice {
+  /// The application expects that it will not access the
+  /// specified data in the near future.
+  DONTNEED   = 1,
+  /// The application expects to access the specified data
+  /// once and then not reuse it thereafter.
+  NOREUSE    = 2,
+  /// The application has no advice to give on its behavior
+  /// with respect to the specified data.
+  NORMAL     = 3,
+  /// The application expects to access the specified data
+  /// in a random order.
+  RANDOM     = 4,
+  /// The application expects to access the specified data
+  /// sequentially from lower offsets to higher offsets.
+  SEQUENTIAL = 5,
+  /// The application expects to access the specified data
+  /// in the near future.
+  WILLNEED   = 6,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+/// Enumeration describing the kind of value stored in [`auxv`](struct.auxv.html).
+#[repr(u32)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum auxtype {
+  /// Base address of the binary argument data provided to
+  /// [`proc_exec()`](fn.proc_exec.html).
+  ARGDATA      = 256,
+  /// Length of the binary argument data provided to
+  /// [`proc_exec()`](fn.proc_exec.html).
+  ARGDATALEN   = 257,
+  /// Base address at which the executable is placed in
+  /// memory.
+  BASE         =   7,
+  /// Base address of a buffer of random data that may be
+  /// used for non-cryptographic purposes, for example as a
+  /// canary for stack smashing protection.
+  CANARY       = 258,
+  /// Length of a buffer of random data that may be used
+  /// for non-cryptographic purposes, for example as a
+  /// canary for stack smashing protection.
+  CANARYLEN    = 259,
+  /// Number of CPUs that the system this process is running
+  /// on has.
+  NCPUS        = 260,
+  /// Terminator of the auxiliary vector.
+  NULL         =   0,
+  /// Smallest memory object size for which individual
+  /// memory protection controls can be configured.
+  PAGESZ       =   6,
+  /// Address of the first ELF program header of the
+  /// executable.
+  PHDR         =   3,
+  /// Number of ELF program headers of the executable.
+  PHNUM        =   4,
+  /// Identifier of the process.
+  ///
+  /// This environment does not provide any simple numerical
+  /// process identifiers, for the reason that these are not
+  /// useful in distributed contexts. Instead, processes are
+  /// identified by a UUID.
+  ///
+  /// This record should point to sixteen bytes of binary
+  /// data, containing a version 4 UUID (fully random).
+  PID          = 263,
+  /// Address of the ELF header of the vDSO.
+  ///
+  /// The vDSO is a shared library that is mapped in the
+  /// address space of the process. It provides entry points
+  /// for every system call supported by the environment,
+  /// all having a corresponding symbol that is prefixed
+  /// with `cloudabi_sys_`. System calls should be invoked
+  /// through these entry points.
+  ///
+  /// The first advantage of letting processes call into a
+  /// vDSO to perform system calls instead of raising
+  /// hardware traps is that it allows for easy emulation of
+  /// executables on top of existing operating systems. The
+  /// second advantage is that in cases where an operating
+  /// system provides native support for CloudABI executables,
+  /// it may still implement partial userspace
+  /// implementations of these system calls to improve
+  /// performance (e.g., [`clock_time_get()`](fn.clock_time_get.html)). It also provides
+  /// a more dynamic way of adding, removing or replacing
+  /// system calls.
+  SYSINFO_EHDR = 262,
+  /// Thread ID of the initial thread of the process.
+  TID          = 261,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u32,
+}
+
+/// Identifiers for clocks.
+#[repr(u32)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum clockid {
+  /// The system-wide monotonic clock, which is defined as a
+  /// clock measuring real time, whose value cannot be
+  /// adjusted and which cannot have negative clock jumps.
+  ///
+  /// The epoch of this clock is undefined. The absolute
+  /// time value of this clock therefore has no meaning.
+  MONOTONIC          = 1,
+  /// The CPU-time clock associated with the current
+  /// process.
+  PROCESS_CPUTIME_ID = 2,
+  /// The system-wide clock measuring real time. Time value
+  /// zero corresponds with 1970-01-01T00:00:00Z.
+  REALTIME           = 3,
+  /// The CPU-time clock associated with the current thread.
+  THREAD_CPUTIME_ID  = 4,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u32,
+}
+
+/// A userspace condition variable.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct condvar(pub u32);
+/// The condition variable is in its initial state. There
+/// are no threads waiting to be woken up. If the
+/// condition variable has any other value, the kernel
+/// must be called to wake up any sleeping threads.
+pub const CONDVAR_HAS_NO_WAITERS: condvar = condvar(0);
+
+/// Identifier for a device containing a file system. Can be used
+/// in combination with [`inode`](struct.inode.html) to uniquely identify a file on the
+/// local system.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct device(pub u64);
+
+/// A reference to the offset of a directory entry.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct dircookie(pub u64);
+/// Permanent reference to the first directory entry
+/// within a directory.
+pub const DIRCOOKIE_START: dircookie = dircookie(0);
+
+/// Error codes returned by system calls.
+///
+/// Not all of these error codes are returned by the system calls
+/// provided by this environment, but are either used in userspace
+/// exclusively or merely provided for alignment with POSIX.
+#[repr(u16)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum errno {
+  /// No error occurred. System call completed successfully.
+  SUCCESS        =  0,
+  /// Argument list too long.
+  TOOBIG         =  1,
+  /// Permission denied.
+  ACCES          =  2,
+  /// Address in use.
+  ADDRINUSE      =  3,
+  /// Address not available.
+  ADDRNOTAVAIL   =  4,
+  /// Address family not supported.
+  AFNOSUPPORT    =  5,
+  /// Resource unavailable, or operation would block.
+  AGAIN          =  6,
+  /// Connection already in progress.
+  ALREADY        =  7,
+  /// Bad file descriptor.
+  BADF           =  8,
+  /// Bad message.
+  BADMSG         =  9,
+  /// Device or resource busy.
+  BUSY           = 10,
+  /// Operation canceled.
+  CANCELED       = 11,
+  /// No child processes.
+  CHILD          = 12,
+  /// Connection aborted.
+  CONNABORTED    = 13,
+  /// Connection refused.
+  CONNREFUSED    = 14,
+  /// Connection reset.
+  CONNRESET      = 15,
+  /// Resource deadlock would occur.
+  DEADLK         = 16,
+  /// Destination address required.
+  DESTADDRREQ    = 17,
+  /// Mathematics argument out of domain of function.
+  DOM            = 18,
+  /// Reserved.
+  DQUOT          = 19,
+  /// File exists.
+  EXIST          = 20,
+  /// Bad address.
+  FAULT          = 21,
+  /// File too large.
+  FBIG           = 22,
+  /// Host is unreachable.
+  HOSTUNREACH    = 23,
+  /// Identifier removed.
+  IDRM           = 24,
+  /// Illegal byte sequence.
+  ILSEQ          = 25,
+  /// Operation in progress.
+  INPROGRESS     = 26,
+  /// Interrupted function.
+  INTR           = 27,
+  /// Invalid argument.
+  INVAL          = 28,
+  /// I/O error.
+  IO             = 29,
+  /// Socket is connected.
+  ISCONN         = 30,
+  /// Is a directory.
+  ISDIR          = 31,
+  /// Too many levels of symbolic links.
+  LOOP           = 32,
+  /// File descriptor value too large.
+  MFILE          = 33,
+  /// Too many links.
+  MLINK          = 34,
+  /// Message too large.
+  MSGSIZE        = 35,
+  /// Reserved.
+  MULTIHOP       = 36,
+  /// Filename too long.
+  NAMETOOLONG    = 37,
+  /// Network is down.
+  NETDOWN        = 38,
+  /// Connection aborted by network.
+  NETRESET       = 39,
+  /// Network unreachable.
+  NETUNREACH     = 40,
+  /// Too many files open in system.
+  NFILE          = 41,
+  /// No buffer space available.
+  NOBUFS         = 42,
+  /// No such device.
+  NODEV          = 43,
+  /// No such file or directory.
+  NOENT          = 44,
+  /// Executable file format error.
+  NOEXEC         = 45,
+  /// No locks available.
+  NOLCK          = 46,
+  /// Reserved.
+  NOLINK         = 47,
+  /// Not enough space.
+  NOMEM          = 48,
+  /// No message of the desired type.
+  NOMSG          = 49,
+  /// Protocol not available.
+  NOPROTOOPT     = 50,
+  /// No space left on device.
+  NOSPC          = 51,
+  /// Function not supported.
+  NOSYS          = 52,
+  /// The socket is not connected.
+  NOTCONN        = 53,
+  /// Not a directory or a symbolic link to a directory.
+  NOTDIR         = 54,
+  /// Directory not empty.
+  NOTEMPTY       = 55,
+  /// State not recoverable.
+  NOTRECOVERABLE = 56,
+  /// Not a socket.
+  NOTSOCK        = 57,
+  /// Not supported, or operation not supported on socket.
+  NOTSUP         = 58,
+  /// Inappropriate I/O control operation.
+  NOTTY          = 59,
+  /// No such device or address.
+  NXIO           = 60,
+  /// Value too large to be stored in data type.
+  OVERFLOW       = 61,
+  /// Previous owner died.
+  OWNERDEAD      = 62,
+  /// Operation not permitted.
+  PERM           = 63,
+  /// Broken pipe.
+  PIPE           = 64,
+  /// Protocol error.
+  PROTO          = 65,
+  /// Protocol not supported.
+  PROTONOSUPPORT = 66,
+  /// Protocol wrong type for socket.
+  PROTOTYPE      = 67,
+  /// Result too large.
+  RANGE          = 68,
+  /// Read-only file system.
+  ROFS           = 69,
+  /// Invalid seek.
+  SPIPE          = 70,
+  /// No such process.
+  SRCH           = 71,
+  /// Reserved.
+  STALE          = 72,
+  /// Connection timed out.
+  TIMEDOUT       = 73,
+  /// Text file busy.
+  TXTBSY         = 74,
+  /// Cross-device link.
+  XDEV           = 75,
+  /// Extension: Capabilities insufficient.
+  NOTCAPABLE     = 76,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u16,
+}
+
+bitflags! {
+  /// The state of the file descriptor subscribed to with
+  /// [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+  #[repr(C)]
+  pub struct eventrwflags: u16 {
+    /// The peer of this socket has closed or disconnected.
+    const HANGUP = 0x0001;
+  }
+}
+
+/// Type of a subscription to an event or its occurrence.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum eventtype {
+  /// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id)
+  /// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout).
+  CLOCK          = 1,
+  /// Condition variable [`subscription.union.condvar.condvar`](struct.subscription_condvar.html#structfield.condvar) has
+  /// been woken up and [`subscription.union.condvar.lock`](struct.subscription_condvar.html#structfield.lock) has been
+  /// acquired for writing.
+  CONDVAR        = 2,
+  /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
+  /// data available for reading. This event always triggers
+  /// for regular files.
+  FD_READ        = 3,
+  /// File descriptor [`subscription.union.fd_readwrite.fd`](struct.subscription_fd_readwrite.html#structfield.fd) has
+  /// capacity available for writing. This event always
+  /// triggers for regular files.
+  FD_WRITE       = 4,
+  /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
+  /// reading.
+  LOCK_RDLOCK    = 5,
+  /// Lock [`subscription.union.lock.lock`](struct.subscription_lock.html#structfield.lock) has been acquired for
+  /// writing.
+  LOCK_WRLOCK    = 6,
+  /// The process associated with process descriptor
+  /// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated.
+  PROC_TERMINATE = 7,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+/// Exit code generated by a process when exiting.
+pub type exitcode = u32;
+
+/// A file descriptor number.
+///
+/// Unlike on POSIX-compliant systems, none of the file descriptor
+/// numbers are reserved for a purpose (e.g., stdin, stdout,
+/// stderr). Operating systems are not required to allocate new
+/// file descriptors in ascending order.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct fd(pub u32);
+/// Returned to the child process by [`proc_fork()`](fn.proc_fork.html).
+pub const PROCESS_CHILD: fd = fd(0xffffffff);
+/// Passed to [`mem_map()`](fn.mem_map.html) when creating a mapping to
+/// anonymous memory.
+pub const MAP_ANON_FD  : fd = fd(0xffffffff);
+
+bitflags! {
+  /// File descriptor flags.
+  #[repr(C)]
+  pub struct fdflags: u16 {
+    /// Append mode: Data written to the file is always
+    /// appended to the file's end.
+    const APPEND   = 0x0001;
+    /// Write according to synchronized I/O data integrity
+    /// completion. Only the data stored in the file is
+    /// synchronized.
+    const DSYNC    = 0x0002;
+    /// Non-blocking mode.
+    const NONBLOCK = 0x0004;
+    /// Synchronized read I/O operations.
+    const RSYNC    = 0x0008;
+    /// Write according to synchronized I/O file integrity
+    /// completion. In addition to synchronizing the data
+    /// stored in the file, the system may also synchronously
+    /// update the file's metadata.
+    const SYNC     = 0x0010;
+  }
+}
+
+bitflags! {
+  /// Which file descriptor attributes to adjust.
+  #[repr(C)]
+  pub struct fdsflags: u16 {
+    /// Adjust the file descriptor flags stored in
+    /// [`fdstat.fs_flags`](struct.fdstat.html#structfield.fs_flags).
+    const FLAGS  = 0x0001;
+    /// Restrict the rights of the file descriptor to the
+    /// rights stored in [`fdstat.fs_rights_base`](struct.fdstat.html#structfield.fs_rights_base) and
+    /// [`fdstat.fs_rights_inheriting`](struct.fdstat.html#structfield.fs_rights_inheriting).
+    const RIGHTS = 0x0002;
+  }
+}
+
+/// Relative offset within a file.
+pub type filedelta = i64;
+
+/// Non-negative file size or length of a region within a file.
+pub type filesize = u64;
+
+/// The type of a file descriptor or file.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum filetype {
+  /// The type of the file descriptor or file is unknown or
+  /// is different from any of the other types specified.
+  UNKNOWN          =   0,
+  /// The file descriptor or file refers to a block device
+  /// inode.
+  BLOCK_DEVICE     =  16,
+  /// The file descriptor or file refers to a character
+  /// device inode.
+  CHARACTER_DEVICE =  17,
+  /// The file descriptor or file refers to a directory
+  /// inode.
+  DIRECTORY        =  32,
+  /// The file descriptor refers to a process handle.
+  PROCESS          =  80,
+  /// The file descriptor or file refers to a regular file
+  /// inode.
+  REGULAR_FILE     =  96,
+  /// The file descriptor refers to a shared memory object.
+  SHARED_MEMORY    = 112,
+  /// The file descriptor or file refers to a datagram
+  /// socket.
+  SOCKET_DGRAM     = 128,
+  /// The file descriptor or file refers to a byte-stream
+  /// socket.
+  SOCKET_STREAM    = 130,
+  /// The file refers to a symbolic link inode.
+  SYMBOLIC_LINK    = 144,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+bitflags! {
+  /// Which file attributes to adjust.
+  #[repr(C)]
+  pub struct fsflags: u16 {
+    /// Adjust the last data access timestamp to the value
+    /// stored in [`filestat.st_atim`](struct.filestat.html#structfield.st_atim).
+    const ATIM     = 0x0001;
+    /// Adjust the last data access timestamp to the time
+    /// of clock [`REALTIME`](enum.clockid.html#variant.REALTIME).
+    const ATIM_NOW = 0x0002;
+    /// Adjust the last data modification timestamp to the
+    /// value stored in [`filestat.st_mtim`](struct.filestat.html#structfield.st_mtim).
+    const MTIM     = 0x0004;
+    /// Adjust the last data modification timestamp to the
+    /// time of clock [`REALTIME`](enum.clockid.html#variant.REALTIME).
+    const MTIM_NOW = 0x0008;
+    /// Truncate or extend the file to the size stored in
+    /// [`filestat.st_size`](struct.filestat.html#structfield.st_size).
+    const SIZE     = 0x0010;
+  }
+}
+
+/// File serial number that is unique within its file system.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct inode(pub u64);
+
+/// Number of hard links to an inode.
+pub type linkcount = u32;
+
+/// A userspace read-recursive readers-writer lock, similar to a
+/// Linux futex or a FreeBSD umtx.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct lock(pub u32);
+/// Value indicating that the lock is in its initial
+/// unlocked state.
+pub const LOCK_UNLOCKED      : lock = lock(0x00000000);
+/// Bitmask indicating that the lock is write-locked. If
+/// set, the lower 30 bits of the lock contain the
+/// identifier of the thread that owns the write lock.
+/// Otherwise, the lower 30 bits of the lock contain the
+/// number of acquired read locks.
+pub const LOCK_WRLOCKED      : lock = lock(0x40000000);
+/// Bitmask indicating that the lock is either read locked
+/// or write locked, and that one or more threads have
+/// their execution suspended, waiting to acquire the
+/// lock. The last owner of the lock must call the
+/// kernel to unlock.
+///
+/// When the lock is acquired for reading and this bit is
+/// set, it means that one or more threads are attempting
+/// to acquire this lock for writing. In that case, other
+/// threads should only acquire additional read locks if
+/// suspending execution would cause a deadlock. It is
+/// preferred to suspend execution, as this prevents
+/// starvation of writers.
+pub const LOCK_KERNEL_MANAGED: lock = lock(0x80000000);
+/// Value indicating that the lock is in an incorrect
+/// state. A lock cannot be in its initial unlocked state,
+/// while also managed by the kernel.
+pub const LOCK_BOGUS         : lock = lock(0x80000000);
+
+bitflags! {
+  /// Flags determining the method of how paths are resolved.
+  #[repr(C)]
+  pub struct lookupflags: u32 {
+    /// As long as the resolved path corresponds to a symbolic
+    /// link, it is expanded.
+    const SYMLINK_FOLLOW = 0x00000001;
+  }
+}
+
+bitflags! {
+  /// Memory mapping flags.
+  #[repr(C)]
+  pub struct mflags: u8 {
+    /// Instead of mapping the contents of the file provided,
+    /// create a mapping to anonymous memory. The file
+    /// descriptor argument must be set to [`MAP_ANON_FD`](constant.MAP_ANON_FD.html),
+    /// and the offset must be set to zero.
+    const ANON    = 0x01;
+    /// Require that the mapping is performed at the base
+    /// address provided.
+    const FIXED   = 0x02;
+    /// Changes are private.
+    const PRIVATE = 0x04;
+    /// Changes are shared.
+    const SHARED  = 0x08;
+  }
+}
+
+bitflags! {
+  /// Memory page protection options.
+  ///
+  /// This implementation enforces the `W^X` property: Pages cannot be
+  /// mapped for execution while also mapped for writing.
+  #[repr(C)]
+  pub struct mprot: u8 {
+    /// Page can be executed.
+    const EXEC  = 0x01;
+    /// Page can be written.
+    const WRITE = 0x02;
+    /// Page can be read.
+    const READ  = 0x04;
+  }
+}
+
+bitflags! {
+  /// Methods of synchronizing memory with physical storage.
+  #[repr(C)]
+  pub struct msflags: u8 {
+    /// Perform asynchronous writes.
+    const ASYNC      = 0x01;
+    /// Invalidate cached data.
+    const INVALIDATE = 0x02;
+    /// Perform synchronous writes.
+    const SYNC       = 0x04;
+  }
+}
+
+/// Specifies the number of threads sleeping on a condition
+/// variable that should be woken up.
+pub type nthreads = u32;
+
+bitflags! {
+  /// Open flags used by [`file_open()`](fn.file_open.html).
+  #[repr(C)]
+  pub struct oflags: u16 {
+    /// Create file if it does not exist.
+    const CREAT     = 0x0001;
+    /// Fail if not a directory.
+    const DIRECTORY = 0x0002;
+    /// Fail if file already exists.
+    const EXCL      = 0x0004;
+    /// Truncate file to size 0.
+    const TRUNC     = 0x0008;
+  }
+}
+
+bitflags! {
+  /// Flags provided to [`sock_recv()`](fn.sock_recv.html).
+  #[repr(C)]
+  pub struct riflags: u16 {
+    /// Returns the message without removing it from the
+    /// socket's receive queue.
+    const PEEK    = 0x0004;
+    /// On byte-stream sockets, block until the full amount
+    /// of data can be returned.
+    const WAITALL = 0x0010;
+  }
+}
+
+bitflags! {
+  /// File descriptor rights, determining which actions may be
+  /// performed.
+  #[repr(C)]
+  pub struct rights: u64 {
+    /// The right to invoke [`fd_datasync()`](fn.fd_datasync.html).
+    ///
+    /// If [`FILE_OPEN`](struct.rights.html#associatedconstant.FILE_OPEN) is set, includes the right to
+    /// invoke [`file_open()`](fn.file_open.html) with [`DSYNC`](struct.fdflags.html#associatedconstant.DSYNC).
+    const FD_DATASYNC           = 0x0000000000000001;
+    /// The right to invoke [`fd_read()`](fn.fd_read.html) and [`sock_recv()`](fn.sock_recv.html).
+    ///
+    /// If [`MEM_MAP`](struct.rights.html#associatedconstant.MEM_MAP) is set, includes the right to
+    /// invoke [`mem_map()`](fn.mem_map.html) with memory protection option
+    /// [`READ`](struct.mprot.html#associatedconstant.READ).
+    ///
+    /// If [`FD_SEEK`](struct.rights.html#associatedconstant.FD_SEEK) is set, includes the right to invoke
+    /// [`fd_pread()`](fn.fd_pread.html).
+    const FD_READ               = 0x0000000000000002;
+    /// The right to invoke [`fd_seek()`](fn.fd_seek.html). This flag implies
+    /// [`FD_TELL`](struct.rights.html#associatedconstant.FD_TELL).
+    const FD_SEEK               = 0x0000000000000004;
+    /// The right to invoke [`fd_stat_put()`](fn.fd_stat_put.html) with
+    /// [`FLAGS`](struct.fdsflags.html#associatedconstant.FLAGS).
+    const FD_STAT_PUT_FLAGS     = 0x0000000000000008;
+    /// The right to invoke [`fd_sync()`](fn.fd_sync.html).
+    ///
+    /// If [`FILE_OPEN`](struct.rights.html#associatedconstant.FILE_OPEN) is set, includes the right to
+    /// invoke [`file_open()`](fn.file_open.html) with [`RSYNC`](struct.fdflags.html#associatedconstant.RSYNC) and
+    /// [`DSYNC`](struct.fdflags.html#associatedconstant.DSYNC).
+    const FD_SYNC               = 0x0000000000000010;
+    /// The right to invoke [`fd_seek()`](fn.fd_seek.html) in such a way that the
+    /// file offset remains unaltered (i.e., [`CUR`](enum.whence.html#variant.CUR) with
+    /// offset zero).
+    const FD_TELL               = 0x0000000000000020;
+    /// The right to invoke [`fd_write()`](fn.fd_write.html) and [`sock_send()`](fn.sock_send.html).
+    ///
+    /// If [`MEM_MAP`](struct.rights.html#associatedconstant.MEM_MAP) is set, includes the right to
+    /// invoke [`mem_map()`](fn.mem_map.html) with memory protection option
+    /// [`WRITE`](struct.mprot.html#associatedconstant.WRITE).
+    ///
+    /// If [`FD_SEEK`](struct.rights.html#associatedconstant.FD_SEEK) is set, includes the right to
+    /// invoke [`fd_pwrite()`](fn.fd_pwrite.html).
+    const FD_WRITE              = 0x0000000000000040;
+    /// The right to invoke [`file_advise()`](fn.file_advise.html).
+    const FILE_ADVISE           = 0x0000000000000080;
+    /// The right to invoke [`file_allocate()`](fn.file_allocate.html).
+    const FILE_ALLOCATE         = 0x0000000000000100;
+    /// The right to invoke [`file_create()`](fn.file_create.html) with
+    /// [`DIRECTORY`](enum.filetype.html#variant.DIRECTORY).
+    const FILE_CREATE_DIRECTORY = 0x0000000000000200;
+    /// If [`FILE_OPEN`](struct.rights.html#associatedconstant.FILE_OPEN) is set, the right to invoke
+    /// [`file_open()`](fn.file_open.html) with [`CREAT`](struct.oflags.html#associatedconstant.CREAT).
+    const FILE_CREATE_FILE      = 0x0000000000000400;
+    /// The right to invoke [`file_link()`](fn.file_link.html) with the file
+    /// descriptor as the source directory.
+    const FILE_LINK_SOURCE      = 0x0000000000001000;
+    /// The right to invoke [`file_link()`](fn.file_link.html) with the file
+    /// descriptor as the target directory.
+    const FILE_LINK_TARGET      = 0x0000000000002000;
+    /// The right to invoke [`file_open()`](fn.file_open.html).
+    const FILE_OPEN             = 0x0000000000004000;
+    /// The right to invoke [`file_readdir()`](fn.file_readdir.html).
+    const FILE_READDIR          = 0x0000000000008000;
+    /// The right to invoke [`file_readlink()`](fn.file_readlink.html).
+    const FILE_READLINK         = 0x0000000000010000;
+    /// The right to invoke [`file_rename()`](fn.file_rename.html) with the file
+    /// descriptor as the source directory.
+    const FILE_RENAME_SOURCE    = 0x0000000000020000;
+    /// The right to invoke [`file_rename()`](fn.file_rename.html) with the file
+    /// descriptor as the target directory.
+    const FILE_RENAME_TARGET    = 0x0000000000040000;
+    /// The right to invoke [`file_stat_fget()`](fn.file_stat_fget.html).
+    const FILE_STAT_FGET        = 0x0000000000080000;
+    /// The right to invoke [`file_stat_fput()`](fn.file_stat_fput.html) with
+    /// [`SIZE`](struct.fsflags.html#associatedconstant.SIZE).
+    ///
+    /// If [`FILE_OPEN`](struct.rights.html#associatedconstant.FILE_OPEN) is set, includes the right to
+    /// invoke [`file_open()`](fn.file_open.html) with [`TRUNC`](struct.oflags.html#associatedconstant.TRUNC).
+    const FILE_STAT_FPUT_SIZE   = 0x0000000000100000;
+    /// The right to invoke [`file_stat_fput()`](fn.file_stat_fput.html) with
+    /// [`ATIM`](struct.fsflags.html#associatedconstant.ATIM), [`ATIM_NOW`](struct.fsflags.html#associatedconstant.ATIM_NOW), [`MTIM`](struct.fsflags.html#associatedconstant.MTIM),
+    /// and [`MTIM_NOW`](struct.fsflags.html#associatedconstant.MTIM_NOW).
+    const FILE_STAT_FPUT_TIMES  = 0x0000000000200000;
+    /// The right to invoke [`file_stat_get()`](fn.file_stat_get.html).
+    const FILE_STAT_GET         = 0x0000000000400000;
+    /// The right to invoke [`file_stat_put()`](fn.file_stat_put.html) with
+    /// [`ATIM`](struct.fsflags.html#associatedconstant.ATIM), [`ATIM_NOW`](struct.fsflags.html#associatedconstant.ATIM_NOW), [`MTIM`](struct.fsflags.html#associatedconstant.MTIM),
+    /// and [`MTIM_NOW`](struct.fsflags.html#associatedconstant.MTIM_NOW).
+    const FILE_STAT_PUT_TIMES   = 0x0000000000800000;
+    /// The right to invoke [`file_symlink()`](fn.file_symlink.html).
+    const FILE_SYMLINK          = 0x0000000001000000;
+    /// The right to invoke [`file_unlink()`](fn.file_unlink.html).
+    const FILE_UNLINK           = 0x0000000002000000;
+    /// The right to invoke [`mem_map()`](fn.mem_map.html) with [`mprot`](struct.mprot.html) set to
+    /// zero.
+    const MEM_MAP               = 0x0000000004000000;
+    /// If [`MEM_MAP`](struct.rights.html#associatedconstant.MEM_MAP) is set, the right to invoke
+    /// [`mem_map()`](fn.mem_map.html) with [`EXEC`](struct.mprot.html#associatedconstant.EXEC).
+    const MEM_MAP_EXEC          = 0x0000000008000000;
+    /// If [`FD_READ`](struct.rights.html#associatedconstant.FD_READ) is set, includes the right to
+    /// invoke [`poll()`](fn.poll.html) to subscribe to [`FD_READ`](enum.eventtype.html#variant.FD_READ).
+    ///
+    /// If [`FD_WRITE`](struct.rights.html#associatedconstant.FD_WRITE) is set, includes the right to
+    /// invoke [`poll()`](fn.poll.html) to subscribe to [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+    const POLL_FD_READWRITE     = 0x0000000010000000;
+    /// The right to invoke [`poll()`](fn.poll.html) to subscribe to
+    /// [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
+    const POLL_PROC_TERMINATE   = 0x0000000040000000;
+    /// The right to invoke [`proc_exec()`](fn.proc_exec.html).
+    const PROC_EXEC             = 0x0000000100000000;
+    /// The right to invoke [`sock_shutdown()`](fn.sock_shutdown.html).
+    const SOCK_SHUTDOWN         = 0x0000008000000000;
+  }
+}
+
+bitflags! {
+  /// Flags returned by [`sock_recv()`](fn.sock_recv.html).
+  #[repr(C)]
+  pub struct roflags: u16 {
+    /// Returned by [`sock_recv()`](fn.sock_recv.html): List of file descriptors
+    /// has been truncated.
+    const FDS_TRUNCATED  = 0x0001;
+    /// Returned by [`sock_recv()`](fn.sock_recv.html): Message data has been
+    /// truncated.
+    const DATA_TRUNCATED = 0x0008;
+  }
+}
+
+/// Indicates whether an object is stored in private or shared
+/// memory.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum scope {
+  /// The object is stored in private memory.
+  PRIVATE = 4,
+  /// The object is stored in shared memory.
+  SHARED  = 8,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+bitflags! {
+  /// Which channels on a socket need to be shut down.
+  #[repr(C)]
+  pub struct sdflags: u8 {
+    /// Disables further receive operations.
+    const RD = 0x01;
+    /// Disables further send operations.
+    const WR = 0x02;
+  }
+}
+
+bitflags! {
+  /// Flags provided to [`sock_send()`](fn.sock_send.html). As there are currently no flags
+  /// defined, it must be set to zero.
+  #[repr(C)]
+  pub struct siflags: u16 {
+    const DEFAULT = 0;
+  }
+}
+
+/// Signal condition.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum signal {
+  /// Process abort signal.
+  ///
+  /// Action: Terminates the process.
+  ABRT   =  1,
+  /// Alarm clock.
+  ///
+  /// Action: Terminates the process.
+  ALRM   =  2,
+  /// Access to an undefined portion of a memory object.
+  ///
+  /// Action: Terminates the process.
+  BUS    =  3,
+  /// Child process terminated, stopped, or continued.
+  ///
+  /// Action: Ignored.
+  CHLD   =  4,
+  /// Continue executing, if stopped.
+  ///
+  /// Action: Continues executing, if stopped.
+  CONT   =  5,
+  /// Erroneous arithmetic operation.
+  ///
+  /// Action: Terminates the process.
+  FPE    =  6,
+  /// Hangup.
+  ///
+  /// Action: Terminates the process.
+  HUP    =  7,
+  /// Illegal instruction.
+  ///
+  /// Action: Terminates the process.
+  ILL    =  8,
+  /// Terminate interrupt signal.
+  ///
+  /// Action: Terminates the process.
+  INT    =  9,
+  /// Kill.
+  ///
+  /// Action: Terminates the process.
+  KILL   = 10,
+  /// Write on a pipe with no one to read it.
+  ///
+  /// Action: Ignored.
+  PIPE   = 11,
+  /// Terminal quit signal.
+  ///
+  /// Action: Terminates the process.
+  QUIT   = 12,
+  /// Invalid memory reference.
+  ///
+  /// Action: Terminates the process.
+  SEGV   = 13,
+  /// Stop executing.
+  ///
+  /// Action: Stops executing.
+  STOP   = 14,
+  /// Bad system call.
+  ///
+  /// Action: Terminates the process.
+  SYS    = 15,
+  /// Termination signal.
+  ///
+  /// Action: Terminates the process.
+  TERM   = 16,
+  /// Trace/breakpoint trap.
+  ///
+  /// Action: Terminates the process.
+  TRAP   = 17,
+  /// Terminal stop signal.
+  ///
+  /// Action: Stops executing.
+  TSTP   = 18,
+  /// Background process attempting read.
+  ///
+  /// Action: Stops executing.
+  TTIN   = 19,
+  /// Background process attempting write.
+  ///
+  /// Action: Stops executing.
+  TTOU   = 20,
+  /// High bandwidth data is available at a socket.
+  ///
+  /// Action: Ignored.
+  URG    = 21,
+  /// User-defined signal 1.
+  ///
+  /// Action: Terminates the process.
+  USR1   = 22,
+  /// User-defined signal 2.
+  ///
+  /// Action: Terminates the process.
+  USR2   = 23,
+  /// Virtual timer expired.
+  ///
+  /// Action: Terminates the process.
+  VTALRM = 24,
+  /// CPU time limit exceeded.
+  ///
+  /// Action: Terminates the process.
+  XCPU   = 25,
+  /// File size limit exceeded.
+  ///
+  /// Action: Terminates the process.
+  XFSZ   = 26,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+bitflags! {
+  /// Flags determining how the timestamp provided in
+  /// [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout) should be interpreted.
+  #[repr(C)]
+  pub struct subclockflags: u16 {
+    /// If set, treat the timestamp provided in
+    /// [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout) as an absolute timestamp
+    /// of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id).
+    ///
+    /// If clear, treat the timestamp provided in
+    /// [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout) relative to the current
+    /// time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id).
+    const ABSTIME = 0x0001;
+  }
+}
+
+bitflags! {
+  /// Flags influencing the method of polling for read or writing on
+  /// a file descriptor.
+  #[repr(C)]
+  pub struct subrwflags: u16 {
+    /// Deprecated. Must be set by callers and ignored by
+    /// implementations.
+    const POLL = 0x0001;
+  }
+}
+
+/// Unique system-local identifier of a thread. This identifier is
+/// only valid during the lifetime of the thread.
+///
+/// Threads must be aware of their thread identifier, as it is
+/// written it into locks when acquiring them for writing. It is
+/// not advised to use these identifiers for any other purpose.
+///
+/// As the thread identifier is also stored in [`lock`](struct.lock.html) when
+/// [`LOCK_WRLOCKED`](constant.LOCK_WRLOCKED.html) is set, the top two bits of the thread
+/// must always be set to zero.
+#[repr(C)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub struct tid(pub u32);
+
+/// Timestamp in nanoseconds.
+pub type timestamp = u64;
+
+bitflags! {
+  /// Specifies whether files are unlinked or directories are
+  /// removed.
+  #[repr(C)]
+  pub struct ulflags: u8 {
+    /// If set, removes a directory. Otherwise, unlinks any
+    /// non-directory file.
+    const REMOVEDIR = 0x01;
+  }
+}
+
+/// User-provided value that can be attached to objects that is
+/// retained when extracted from the kernel.
+pub type userdata = u64;
+
+/// Relative to which position the offset of the file descriptor
+/// should be set.
+#[repr(u8)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+pub enum whence {
+  /// Seek relative to current position.
+  CUR = 1,
+  /// Seek relative to end-of-file.
+  END = 2,
+  /// Seek relative to start-of-file.
+  SET = 3,
+  #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
+}
+
+/// Auxiliary vector entry.
+///
+/// The auxiliary vector is a list of key-value pairs that is
+/// provided to the process on startup. Unlike structures, it is
+/// extensible, as it is possible to add new records later on.
+/// The auxiliary vector is always terminated by an entry having
+/// type [`NULL`](enum.auxtype.html#variant.NULL).
+///
+/// The auxiliary vector is part of the x86-64 ABI, but is used by
+/// this environment on all architectures.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct auxv {
+  /// The type of the auxiliary vector entry.
+  pub a_type: auxtype,
+  pub union: auxv_union
+}
+/// A union inside `auxv`.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union auxv_union {
+  /// Used when `a_type` is [`ARGDATALEN`](enum.auxtype.html#variant.ARGDATALEN), [`CANARYLEN`](enum.auxtype.html#variant.CANARYLEN), [`NCPUS`](enum.auxtype.html#variant.NCPUS), [`PAGESZ`](enum.auxtype.html#variant.PAGESZ), [`PHNUM`](enum.auxtype.html#variant.PHNUM), or [`TID`](enum.auxtype.html#variant.TID).
+/// A numerical value.
+  pub a_val: usize,
+  /// Used when `a_type` is [`ARGDATA`](enum.auxtype.html#variant.ARGDATA), [`BASE`](enum.auxtype.html#variant.BASE), [`CANARY`](enum.auxtype.html#variant.CANARY), [`PHDR`](enum.auxtype.html#variant.PHDR), [`PID`](enum.auxtype.html#variant.PID), or [`SYSINFO_EHDR`](enum.auxtype.html#variant.SYSINFO_EHDR).
+/// A pointer value.
+  pub a_ptr: *mut (),
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn auxv_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<auxv>(), 8);
+  assert_eq!(::core::mem::align_of::<auxv>(), 4);
+  unsafe {
+    let obj: auxv = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.a_type as *const _ as usize - base, 0);
+    assert_eq!(&obj.union.a_val as *const _ as usize - base, 4);
+    assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 4);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn auxv_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<auxv>(), 16);
+  assert_eq!(::core::mem::align_of::<auxv>(), 8);
+  unsafe {
+    let obj: auxv = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.a_type as *const _ as usize - base, 0);
+    assert_eq!(&obj.union.a_val as *const _ as usize - base, 8);
+    assert_eq!(&obj.union.a_ptr as *const _ as usize - base, 8);
+  }
+}
+
+/// A region of memory for scatter/gather writes.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ciovec {
+  /// The address and length of the buffer to be written.
+  pub buf: (*const (), usize),
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn ciovec_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<ciovec>(), 8);
+  assert_eq!(::core::mem::align_of::<ciovec>(), 4);
+  unsafe {
+    let obj: ciovec = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn ciovec_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<ciovec>(), 16);
+  assert_eq!(::core::mem::align_of::<ciovec>(), 8);
+  unsafe {
+    let obj: ciovec = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
+  }
+}
+
+/// A directory entry.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct dirent {
+  /// The offset of the next directory entry stored in this
+  /// directory.
+  pub d_next: dircookie,
+  /// The serial number of the file referred to by this
+  /// directory entry.
+  pub d_ino: inode,
+  /// The length of the name of the directory entry.
+  pub d_namlen: u32,
+  /// The type of the file referred to by this directory
+  /// entry.
+  pub d_type: filetype,
+}
+#[test]
+fn dirent_layout_test() {
+  assert_eq!(::core::mem::size_of::<dirent>(), 24);
+  assert_eq!(::core::mem::align_of::<dirent>(), 8);
+  unsafe {
+    let obj: dirent = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.d_next as *const _ as usize - base, 0);
+    assert_eq!(&obj.d_ino as *const _ as usize - base, 8);
+    assert_eq!(&obj.d_namlen as *const _ as usize - base, 16);
+    assert_eq!(&obj.d_type as *const _ as usize - base, 20);
+  }
+}
+
+/// An event that occurred.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct event {
+  /// User-provided value that got attached to
+  /// [`subscription.userdata`](struct.subscription.html#structfield.userdata).
+  pub userdata: userdata,
+  /// If non-zero, an error that occurred while processing
+  /// the subscription request.
+  pub error: errno,
+  /// The type of the event that occurred.
+  pub type_: eventtype,
+  pub union: event_union
+}
+/// A union inside `event`.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union event_union {
+  /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+  pub fd_readwrite: event_fd_readwrite,
+  /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
+  pub proc_terminate: event_proc_terminate,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct event_fd_readwrite {
+  /// The number of bytes available
+  /// for reading or writing.
+  pub nbytes: filesize,
+  /// Obsolete.
+  pub unused: [u8; 4],
+  /// The state of the file
+  /// descriptor.
+  pub flags: eventrwflags,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct event_proc_terminate {
+  /// Obsolete.
+  pub unused: [u8; 4],
+  /// If zero, the process has
+  /// exited.
+  /// Otherwise, the signal
+  /// condition causing it to
+  /// terminated.
+  pub signal: signal,
+  /// If exited, the exit code of
+  /// the process.
+  pub exitcode: exitcode,
+}
+#[test]
+fn event_layout_test() {
+  assert_eq!(::core::mem::size_of::<event>(), 32);
+  assert_eq!(::core::mem::align_of::<event>(), 8);
+  unsafe {
+    let obj: event = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+    assert_eq!(&obj.error as *const _ as usize - base, 8);
+    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+    assert_eq!(&obj.union.fd_readwrite.nbytes as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.fd_readwrite.unused as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 28);
+    assert_eq!(&obj.union.proc_terminate.unused as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.proc_terminate.signal as *const _ as usize - base, 20);
+    assert_eq!(&obj.union.proc_terminate.exitcode as *const _ as usize - base, 24);
+  }
+}
+
+/// File descriptor attributes.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct fdstat {
+  /// File type.
+  pub fs_filetype: filetype,
+  /// File descriptor flags.
+  pub fs_flags: fdflags,
+  /// Rights that apply to this file descriptor.
+  pub fs_rights_base: rights,
+  /// Maximum set of rights that can be installed on new
+  /// file descriptors that are created through this file
+  /// descriptor, e.g., through [`file_open()`](fn.file_open.html).
+  pub fs_rights_inheriting: rights,
+}
+#[test]
+fn fdstat_layout_test() {
+  assert_eq!(::core::mem::size_of::<fdstat>(), 24);
+  assert_eq!(::core::mem::align_of::<fdstat>(), 8);
+  unsafe {
+    let obj: fdstat = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0);
+    assert_eq!(&obj.fs_flags as *const _ as usize - base, 2);
+    assert_eq!(&obj.fs_rights_base as *const _ as usize - base, 8);
+    assert_eq!(&obj.fs_rights_inheriting as *const _ as usize - base, 16);
+  }
+}
+
+/// File attributes.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct filestat {
+  /// Device ID of device containing the file.
+  pub st_dev: device,
+  /// File serial number.
+  pub st_ino: inode,
+  /// File type.
+  pub st_filetype: filetype,
+  /// Number of hard links to the file.
+  pub st_nlink: linkcount,
+  /// For regular files, the file size in bytes. For
+  /// symbolic links, the length in bytes of the pathname
+  /// contained in the symbolic link.
+  pub st_size: filesize,
+  /// Last data access timestamp.
+  pub st_atim: timestamp,
+  /// Last data modification timestamp.
+  pub st_mtim: timestamp,
+  /// Last file status change timestamp.
+  pub st_ctim: timestamp,
+}
+#[test]
+fn filestat_layout_test() {
+  assert_eq!(::core::mem::size_of::<filestat>(), 56);
+  assert_eq!(::core::mem::align_of::<filestat>(), 8);
+  unsafe {
+    let obj: filestat = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.st_dev as *const _ as usize - base, 0);
+    assert_eq!(&obj.st_ino as *const _ as usize - base, 8);
+    assert_eq!(&obj.st_filetype as *const _ as usize - base, 16);
+    assert_eq!(&obj.st_nlink as *const _ as usize - base, 20);
+    assert_eq!(&obj.st_size as *const _ as usize - base, 24);
+    assert_eq!(&obj.st_atim as *const _ as usize - base, 32);
+    assert_eq!(&obj.st_mtim as *const _ as usize - base, 40);
+    assert_eq!(&obj.st_ctim as *const _ as usize - base, 48);
+  }
+}
+
+/// A region of memory for scatter/gather reads.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct iovec {
+  /// The address and length of the buffer to be filled.
+  pub buf: (*mut (), usize),
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn iovec_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<iovec>(), 8);
+  assert_eq!(::core::mem::align_of::<iovec>(), 4);
+  unsafe {
+    let obj: iovec = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn iovec_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<iovec>(), 16);
+  assert_eq!(::core::mem::align_of::<iovec>(), 8);
+  unsafe {
+    let obj: iovec = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
+  }
+}
+
+/// Path lookup properties.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct lookup {
+  /// The working directory at which the resolution of the
+  /// path starts.
+  pub fd: fd,
+  /// Flags determining the method of how the path is
+  /// resolved.
+  pub flags: lookupflags,
+}
+#[test]
+fn lookup_layout_test() {
+  assert_eq!(::core::mem::size_of::<lookup>(), 8);
+  assert_eq!(::core::mem::align_of::<lookup>(), 4);
+  unsafe {
+    let obj: lookup = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.fd as *const _ as usize - base, 0);
+    assert_eq!(&obj.flags as *const _ as usize - base, 4);
+  }
+}
+
+/// Entry point for a process (`_start`).
+///
+/// **auxv**:
+/// The auxiliary vector. See [`auxv`](struct.auxv.html).
+pub type processentry = unsafe extern "C" fn(
+  auxv: *const auxv,
+) -> ();
+
+/// Arguments of [`sock_recv()`](fn.sock_recv.html).
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct recv_in {
+  /// List of scatter/gather vectors where message data
+  /// should be stored.
+  pub ri_data: (*const iovec, usize),
+  /// Buffer where numbers of incoming file descriptors
+  /// should be stored.
+  pub ri_fds: (*mut fd, usize),
+  /// Message flags.
+  pub ri_flags: riflags,
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn recv_in_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<recv_in>(), 20);
+  assert_eq!(::core::mem::align_of::<recv_in>(), 4);
+  unsafe {
+    let obj: recv_in = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4);
+    assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 8);
+    assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 12);
+    assert_eq!(&obj.ri_flags as *const _ as usize - base, 16);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn recv_in_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<recv_in>(), 40);
+  assert_eq!(::core::mem::align_of::<recv_in>(), 8);
+  unsafe {
+    let obj: recv_in = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8);
+    assert_eq!(&obj.ri_fds.0 as *const _ as usize - base, 16);
+    assert_eq!(&obj.ri_fds.1 as *const _ as usize - base, 24);
+    assert_eq!(&obj.ri_flags as *const _ as usize - base, 32);
+  }
+}
+
+/// Results of [`sock_recv()`](fn.sock_recv.html).
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct recv_out {
+  /// Number of bytes stored in [`recv_in.ri_data`](struct.recv_in.html#structfield.ri_data).
+  pub ro_datalen: usize,
+  /// Number of file descriptors stored in [`recv_in.ri_fds`](struct.recv_in.html#structfield.ri_fds).
+  pub ro_fdslen: usize,
+  /// Fields that were used by previous implementations.
+  pub ro_unused: [u8; 40],
+  /// Message flags.
+  pub ro_flags: roflags,
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn recv_out_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<recv_out>(), 52);
+  assert_eq!(::core::mem::align_of::<recv_out>(), 4);
+  unsafe {
+    let obj: recv_out = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
+    assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4);
+    assert_eq!(&obj.ro_unused as *const _ as usize - base, 8);
+    assert_eq!(&obj.ro_flags as *const _ as usize - base, 48);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn recv_out_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<recv_out>(), 64);
+  assert_eq!(::core::mem::align_of::<recv_out>(), 8);
+  unsafe {
+    let obj: recv_out = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
+    assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8);
+    assert_eq!(&obj.ro_unused as *const _ as usize - base, 16);
+    assert_eq!(&obj.ro_flags as *const _ as usize - base, 56);
+  }
+}
+
+/// Arguments of [`sock_send()`](fn.sock_send.html).
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct send_in {
+  /// List of scatter/gather vectors where message data
+  /// should be retrieved.
+  pub si_data: (*const ciovec, usize),
+  /// File descriptors that need to be attached to the
+  /// message.
+  pub si_fds: (*const fd, usize),
+  /// Message flags.
+  pub si_flags: siflags,
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn send_in_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<send_in>(), 20);
+  assert_eq!(::core::mem::align_of::<send_in>(), 4);
+  unsafe {
+    let obj: send_in = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4);
+    assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 8);
+    assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 12);
+    assert_eq!(&obj.si_flags as *const _ as usize - base, 16);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn send_in_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<send_in>(), 40);
+  assert_eq!(::core::mem::align_of::<send_in>(), 8);
+  unsafe {
+    let obj: send_in = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
+    assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8);
+    assert_eq!(&obj.si_fds.0 as *const _ as usize - base, 16);
+    assert_eq!(&obj.si_fds.1 as *const _ as usize - base, 24);
+    assert_eq!(&obj.si_flags as *const _ as usize - base, 32);
+  }
+}
+
+/// Results of [`sock_send()`](fn.sock_send.html).
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct send_out {
+  /// Number of bytes transmitted.
+  pub so_datalen: usize,
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn send_out_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<send_out>(), 4);
+  assert_eq!(::core::mem::align_of::<send_out>(), 4);
+  unsafe {
+    let obj: send_out = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn send_out_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<send_out>(), 8);
+  assert_eq!(::core::mem::align_of::<send_out>(), 8);
+  unsafe {
+    let obj: send_out = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
+  }
+}
+
+/// Subscription to an event.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription {
+  /// User-provided value that is attached to the
+  /// subscription in the kernel and returned through
+  /// [`event.userdata`](struct.event.html#structfield.userdata).
+  pub userdata: userdata,
+  /// Used by previous implementations. Ignored.
+  pub unused: u16,
+  /// The type of the event to which to subscribe.
+  ///
+  /// Currently, [`CONDVAR`](enum.eventtype.html#variant.CONDVAR),
+  /// [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK), and [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK)
+  /// must be provided as the first subscription and may
+  /// only be followed by up to one other subscription,
+  /// having type [`CLOCK`](enum.eventtype.html#variant.CLOCK).
+  pub type_: eventtype,
+  pub union: subscription_union
+}
+/// A union inside `subscription`.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union subscription_union {
+  /// Used when `type_` is [`CLOCK`](enum.eventtype.html#variant.CLOCK).
+  pub clock: subscription_clock,
+  /// Used when `type_` is [`CONDVAR`](enum.eventtype.html#variant.CONDVAR).
+  pub condvar: subscription_condvar,
+  /// Used when `type_` is [`FD_READ`](enum.eventtype.html#variant.FD_READ) or [`FD_WRITE`](enum.eventtype.html#variant.FD_WRITE).
+  pub fd_readwrite: subscription_fd_readwrite,
+  /// Used when `type_` is [`LOCK_RDLOCK`](enum.eventtype.html#variant.LOCK_RDLOCK) or [`LOCK_WRLOCK`](enum.eventtype.html#variant.LOCK_WRLOCK).
+  pub lock: subscription_lock,
+  /// Used when `type_` is [`PROC_TERMINATE`](enum.eventtype.html#variant.PROC_TERMINATE).
+  pub proc_terminate: subscription_proc_terminate,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription_clock {
+  /// The user-defined unique
+  /// identifier of the clock.
+  pub identifier: userdata,
+  /// The clock against which the
+  /// timestamp should be compared.
+  pub clock_id: clockid,
+  /// The absolute or relative
+  /// timestamp.
+  pub timeout: timestamp,
+  /// The amount of time that the
+  /// kernel may wait additionally
+  /// to coalesce with other events.
+  pub precision: timestamp,
+  /// Flags specifying whether the
+  /// timeout is absolute or
+  /// relative.
+  pub flags: subclockflags,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription_condvar {
+  /// The condition variable on
+  /// which to wait to be woken up.
+  pub condvar: *mut condvar,
+  /// The lock that will be
+  /// released while waiting.
+  ///
+  /// The lock will be reacquired
+  /// for writing when the condition
+  /// variable triggers.
+  pub lock: *mut lock,
+  /// Whether the condition variable
+  /// is stored in private or shared
+  /// memory.
+  pub condvar_scope: scope,
+  /// Whether the lock is stored in
+  /// private or shared memory.
+  pub lock_scope: scope,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription_fd_readwrite {
+  /// The file descriptor on which
+  /// to wait for it to become ready
+  /// for reading or writing.
+  pub fd: fd,
+  /// Under which conditions to
+  /// trigger.
+  pub flags: subrwflags,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription_lock {
+  /// The lock that will be acquired
+  /// for reading or writing.
+  pub lock: *mut lock,
+  /// Whether the lock is stored in
+  /// private or shared memory.
+  pub lock_scope: scope,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct subscription_proc_terminate {
+  /// The process descriptor on
+  /// which to wait for process
+  /// termination.
+  pub fd: fd,
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn subscription_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<subscription>(), 56);
+  assert_eq!(::core::mem::align_of::<subscription>(), 8);
+  unsafe {
+    let obj: subscription = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+    assert_eq!(&obj.unused as *const _ as usize - base, 8);
+    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+    assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
+    assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
+    assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
+    assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 20);
+    assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 25);
+    assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
+    assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 20);
+    assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn subscription_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<subscription>(), 56);
+  assert_eq!(::core::mem::align_of::<subscription>(), 8);
+  unsafe {
+    let obj: subscription = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.userdata as *const _ as usize - base, 0);
+    assert_eq!(&obj.unused as *const _ as usize - base, 8);
+    assert_eq!(&obj.type_ as *const _ as usize - base, 10);
+    assert_eq!(&obj.union.clock.identifier as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.clock.clock_id as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.clock.timeout as *const _ as usize - base, 32);
+    assert_eq!(&obj.union.clock.precision as *const _ as usize - base, 40);
+    assert_eq!(&obj.union.clock.flags as *const _ as usize - base, 48);
+    assert_eq!(&obj.union.condvar.condvar as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.condvar.lock as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.condvar.condvar_scope as *const _ as usize - base, 32);
+    assert_eq!(&obj.union.condvar.lock_scope as *const _ as usize - base, 33);
+    assert_eq!(&obj.union.fd_readwrite.fd as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.fd_readwrite.flags as *const _ as usize - base, 20);
+    assert_eq!(&obj.union.lock.lock as *const _ as usize - base, 16);
+    assert_eq!(&obj.union.lock.lock_scope as *const _ as usize - base, 24);
+    assert_eq!(&obj.union.proc_terminate.fd as *const _ as usize - base, 16);
+  }
+}
+
+/// The Thread Control Block (TCB).
+///
+/// After a thread begins execution (at program startup or when
+/// created through [`thread_create()`](fn.thread_create.html)), the CPU's registers
+/// controlling Thread-Local Storage (TLS) will already be
+/// initialized. They will point to an area only containing the
+/// TCB.
+///
+/// If the thread needs space for storing thread-specific
+/// variables, the thread may allocate a larger area and adjust
+/// the CPU's registers to point to that area instead. However, it
+/// does need to make sure that the TCB is copied over to the new
+/// TLS area.
+///
+/// The purpose of the TCB is that it allows light-weight
+/// emulators to store information related to individual threads.
+/// For example, it may be used to store a copy of the CPU
+/// registers prior emulation, so that TLS for the host system
+/// can be restored if needed.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct tcb {
+  /// Pointer that may be freely assigned by the system. Its
+  /// value cannot be interpreted by the application.
+  pub parent: *mut (),
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn tcb_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<tcb>(), 4);
+  assert_eq!(::core::mem::align_of::<tcb>(), 4);
+  unsafe {
+    let obj: tcb = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.parent as *const _ as usize - base, 0);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn tcb_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<tcb>(), 8);
+  assert_eq!(::core::mem::align_of::<tcb>(), 8);
+  unsafe {
+    let obj: tcb = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.parent as *const _ as usize - base, 0);
+  }
+}
+
+/// Entry point for additionally created threads.
+///
+/// **tid**:
+/// Thread ID of the current thread.
+///
+/// **aux**:
+/// Copy of the value stored in
+/// [`threadattr.argument`](struct.threadattr.html#structfield.argument).
+pub type threadentry = unsafe extern "C" fn(
+  tid: tid,
+  aux: *mut (),
+) -> ();
+
+/// Attributes for thread creation.
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct threadattr {
+  /// Initial program counter value.
+  pub entry_point: threadentry,
+  /// Region allocated to serve as stack space.
+  pub stack: (*mut (), usize),
+  /// Argument to be forwarded to the entry point function.
+  pub argument: *mut (),
+}
+#[test]
+#[cfg(target_pointer_width = "32")]
+fn threadattr_layout_test_32() {
+  assert_eq!(::core::mem::size_of::<threadattr>(), 16);
+  assert_eq!(::core::mem::align_of::<threadattr>(), 4);
+  unsafe {
+    let obj: threadattr = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
+    assert_eq!(&obj.stack.0 as *const _ as usize - base, 4);
+    assert_eq!(&obj.stack.1 as *const _ as usize - base, 8);
+    assert_eq!(&obj.argument as *const _ as usize - base, 12);
+  }
+}
+#[test]
+#[cfg(target_pointer_width = "64")]
+fn threadattr_layout_test_64() {
+  assert_eq!(::core::mem::size_of::<threadattr>(), 32);
+  assert_eq!(::core::mem::align_of::<threadattr>(), 8);
+  unsafe {
+    let obj: threadattr = ::core::mem::uninitialized();
+    let base = &obj as *const _ as usize;
+    assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
+    assert_eq!(&obj.stack.0 as *const _ as usize - base, 8);
+    assert_eq!(&obj.stack.1 as *const _ as usize - base, 16);
+    assert_eq!(&obj.argument as *const _ as usize - base, 24);
+  }
+}
+
+/// The table with pointers to all syscall implementations.
+#[allow(improper_ctypes)]
+extern "C" {
+  fn cloudabi_sys_clock_res_get(_: clockid, _: *mut timestamp) -> errno;
+  fn cloudabi_sys_clock_time_get(_: clockid, _: timestamp, _: *mut timestamp) -> errno;
+  fn cloudabi_sys_condvar_signal(_: *mut condvar, _: scope, _: nthreads) -> errno;
+  fn cloudabi_sys_fd_close(_: fd) -> errno;
+  fn cloudabi_sys_fd_create1(_: filetype, _: *mut fd) -> errno;
+  fn cloudabi_sys_fd_create2(_: filetype, _: *mut fd, _: *mut fd) -> errno;
+  fn cloudabi_sys_fd_datasync(_: fd) -> errno;
+  fn cloudabi_sys_fd_dup(_: fd, _: *mut fd) -> errno;
+  fn cloudabi_sys_fd_pread(_: fd, _: *const iovec, _: usize, _: filesize, _: *mut usize) -> errno;
+  fn cloudabi_sys_fd_pwrite(_: fd, _: *const ciovec, _: usize, _: filesize, _: *mut usize) -> errno;
+  fn cloudabi_sys_fd_read(_: fd, _: *const iovec, _: usize, _: *mut usize) -> errno;
+  fn cloudabi_sys_fd_replace(_: fd, _: fd) -> errno;
+  fn cloudabi_sys_fd_seek(_: fd, _: filedelta, _: whence, _: *mut filesize) -> errno;
+  fn cloudabi_sys_fd_stat_get(_: fd, _: *mut fdstat) -> errno;
+  fn cloudabi_sys_fd_stat_put(_: fd, _: *const fdstat, _: fdsflags) -> errno;
+  fn cloudabi_sys_fd_sync(_: fd) -> errno;
+  fn cloudabi_sys_fd_write(_: fd, _: *const ciovec, _: usize, _: *mut usize) -> errno;
+  fn cloudabi_sys_file_advise(_: fd, _: filesize, _: filesize, _: advice) -> errno;
+  fn cloudabi_sys_file_allocate(_: fd, _: filesize, _: filesize) -> errno;
+  fn cloudabi_sys_file_create(_: fd, _: *const u8, _: usize, _: filetype) -> errno;
+  fn cloudabi_sys_file_link(_: lookup, _: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
+  fn cloudabi_sys_file_open(_: lookup, _: *const u8, _: usize, _: oflags, _: *const fdstat, _: *mut fd) -> errno;
+  fn cloudabi_sys_file_readdir(_: fd, _: *mut (), _: usize, _: dircookie, _: *mut usize) -> errno;
+  fn cloudabi_sys_file_readlink(_: fd, _: *const u8, _: usize, _: *mut u8, _: usize, _: *mut usize) -> errno;
+  fn cloudabi_sys_file_rename(_: fd, _: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
+  fn cloudabi_sys_file_stat_fget(_: fd, _: *mut filestat) -> errno;
+  fn cloudabi_sys_file_stat_fput(_: fd, _: *const filestat, _: fsflags) -> errno;
+  fn cloudabi_sys_file_stat_get(_: lookup, _: *const u8, _: usize, _: *mut filestat) -> errno;
+  fn cloudabi_sys_file_stat_put(_: lookup, _: *const u8, _: usize, _: *const filestat, _: fsflags) -> errno;
+  fn cloudabi_sys_file_symlink(_: *const u8, _: usize, _: fd, _: *const u8, _: usize) -> errno;
+  fn cloudabi_sys_file_unlink(_: fd, _: *const u8, _: usize, _: ulflags) -> errno;
+  fn cloudabi_sys_lock_unlock(_: *mut lock, _: scope) -> errno;
+  fn cloudabi_sys_mem_advise(_: *mut (), _: usize, _: advice) -> errno;
+  fn cloudabi_sys_mem_map(_: *mut (), _: usize, _: mprot, _: mflags, _: fd, _: filesize, _: *mut *mut ()) -> errno;
+  fn cloudabi_sys_mem_protect(_: *mut (), _: usize, _: mprot) -> errno;
+  fn cloudabi_sys_mem_sync(_: *mut (), _: usize, _: msflags) -> errno;
+  fn cloudabi_sys_mem_unmap(_: *mut (), _: usize) -> errno;
+  fn cloudabi_sys_poll(_: *const subscription, _: *mut event, _: usize, _: *mut usize) -> errno;
+  fn cloudabi_sys_proc_exec(_: fd, _: *const (), _: usize, _: *const fd, _: usize) -> errno;
+  fn cloudabi_sys_proc_exit(_: exitcode) -> !;
+  fn cloudabi_sys_proc_fork(_: *mut fd, _: *mut tid) -> errno;
+  fn cloudabi_sys_proc_raise(_: signal) -> errno;
+  fn cloudabi_sys_random_get(_: *mut (), _: usize) -> errno;
+  fn cloudabi_sys_sock_recv(_: fd, _: *const recv_in, _: *mut recv_out) -> errno;
+  fn cloudabi_sys_sock_send(_: fd, _: *const send_in, _: *mut send_out) -> errno;
+  fn cloudabi_sys_sock_shutdown(_: fd, _: sdflags) -> errno;
+  fn cloudabi_sys_thread_create(_: *mut threadattr, _: *mut tid) -> errno;
+  fn cloudabi_sys_thread_exit(_: *mut lock, _: scope) -> !;
+  fn cloudabi_sys_thread_yield() -> errno;
+}
+
+/// Obtains the resolution of a clock.
+///
+/// ## Parameters
+///
+/// **clock_id**:
+/// The clock for which the resolution needs to be
+/// returned.
+///
+/// **resolution**:
+/// The resolution of the clock.
+#[inline]
+pub unsafe fn clock_res_get(clock_id_: clockid, resolution_: &mut timestamp) -> errno {
+  cloudabi_sys_clock_res_get(clock_id_, resolution_)
+}
+
+/// Obtains the time value of a clock.
+///
+/// ## Parameters
+///
+/// **clock_id**:
+/// The clock for which the time needs to be
+/// returned.
+///
+/// **precision**:
+/// The maximum lag (exclusive) that the returned
+/// time value may have, compared to its actual
+/// value.
+///
+/// **time**:
+/// The time value of the clock.
+#[inline]
+pub unsafe fn clock_time_get(clock_id_: clockid, precision_: timestamp, time_: &mut timestamp) -> errno {
+  cloudabi_sys_clock_time_get(clock_id_, precision_, time_)
+}
+
+/// Wakes up threads waiting on a userspace condition variable.
+///
+/// If an invocation of this system call causes all waiting
+/// threads to be woken up, the value of the condition variable
+/// is set to [`CONDVAR_HAS_NO_WAITERS`](constant.CONDVAR_HAS_NO_WAITERS.html). As long as the condition
+/// variable is set to this value, it is not needed to invoke this
+/// system call.
+///
+/// ## Parameters
+///
+/// **condvar**:
+/// The userspace condition variable that has
+/// waiting threads.
+///
+/// **scope**:
+/// Whether the condition variable is stored in
+/// private or shared memory.
+///
+/// **nwaiters**:
+/// The number of threads that need to be woken
+/// up. If it exceeds the number of waiting
+/// threads, all threads are woken up.
+#[inline]
+pub unsafe fn condvar_signal(condvar_: *mut condvar, scope_: scope, nwaiters_: nthreads) -> errno {
+  cloudabi_sys_condvar_signal(condvar_, scope_, nwaiters_)
+}
+
+/// Closes a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor that needs to be closed.
+#[inline]
+pub unsafe fn fd_close(fd_: fd) -> errno {
+  cloudabi_sys_fd_close(fd_)
+}
+
+/// Creates a file descriptor.
+///
+/// ## Parameters
+///
+/// **type**:
+/// Possible values:
+///
+///   - [`SHARED_MEMORY`](enum.filetype.html#variant.SHARED_MEMORY):
+///     Creates an anonymous shared memory
+///     object.
+///
+/// **fd**:
+/// The file descriptor that has been created.
+#[inline]
+pub unsafe fn fd_create1(type_: filetype, fd_: &mut fd) -> errno {
+  cloudabi_sys_fd_create1(type_, fd_)
+}
+
+/// Creates a pair of file descriptors.
+///
+/// ## Parameters
+///
+/// **type**:
+/// Possible values:
+///
+///   - [`SOCKET_DGRAM`](enum.filetype.html#variant.SOCKET_DGRAM):
+///     Creates a UNIX datagram socket pair.
+///   - [`SOCKET_STREAM`](enum.filetype.html#variant.SOCKET_STREAM):
+///     Creates a UNIX byte-stream socket
+///     pair.
+///
+/// **fd1**:
+/// The first file descriptor of the pair.
+///
+/// **fd2**:
+/// The second file descriptor of the pair.
+#[inline]
+pub unsafe fn fd_create2(type_: filetype, fd1_: &mut fd, fd2_: &mut fd) -> errno {
+  cloudabi_sys_fd_create2(type_, fd1_, fd2_)
+}
+
+/// Synchronizes the data of a file to disk.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor of the file whose data
+/// needs to be synchronized to disk.
+#[inline]
+pub unsafe fn fd_datasync(fd_: fd) -> errno {
+  cloudabi_sys_fd_datasync(fd_)
+}
+
+/// Duplicates a file descriptor.
+///
+/// ## Parameters
+///
+/// **from**:
+/// The file descriptor that needs to be
+/// duplicated.
+///
+/// **fd**:
+/// The new file descriptor.
+#[inline]
+pub unsafe fn fd_dup(from_: fd, fd_: &mut fd) -> errno {
+  cloudabi_sys_fd_dup(from_, fd_)
+}
+
+/// Reads from a file descriptor, without using and updating the
+/// file descriptor's offset.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor from which data should be
+/// read.
+///
+/// **iovs**:
+/// List of scatter/gather vectors where data
+/// should be stored.
+///
+/// **offset**:
+/// The offset within the file at which reading
+/// should start.
+///
+/// **nread**:
+/// The number of bytes read.
+#[inline]
+pub unsafe fn fd_pread(fd_: fd, iovs_: &[iovec], offset_: filesize, nread_: &mut usize) -> errno {
+  cloudabi_sys_fd_pread(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nread_)
+}
+
+/// Writes to a file descriptor, without using and updating the
+/// file descriptor's offset.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor to which data should be
+/// written.
+///
+/// **iovs**:
+/// List of scatter/gather vectors where data
+/// should be retrieved.
+///
+/// **offset**:
+/// The offset within the file at which writing
+/// should start.
+///
+/// **nwritten**:
+/// The number of bytes written.
+#[inline]
+pub unsafe fn fd_pwrite(fd_: fd, iovs_: &[ciovec], offset_: filesize, nwritten_: &mut usize) -> errno {
+  cloudabi_sys_fd_pwrite(fd_, iovs_.as_ptr(), iovs_.len(), offset_, nwritten_)
+}
+
+/// Reads from a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor from which data should be
+/// read.
+///
+/// **iovs**:
+/// List of scatter/gather vectors where data
+/// should be stored.
+///
+/// **nread**:
+/// The number of bytes read.
+#[inline]
+pub unsafe fn fd_read(fd_: fd, iovs_: &[iovec], nread_: &mut usize) -> errno {
+  cloudabi_sys_fd_read(fd_, iovs_.as_ptr(), iovs_.len(), nread_)
+}
+
+/// Atomically replaces a file descriptor by a copy of another
+/// file descriptor.
+///
+/// Due to the strong focus on thread safety, this environment
+/// does not provide a mechanism to duplicate a file descriptor to
+/// an arbitrary number, like dup2(). This would be prone to race
+/// conditions, as an actual file descriptor with the same number
+/// could be allocated by a different thread at the same time.
+///
+/// This system call provides a way to atomically replace file
+/// descriptors, which would disappear if dup2() were to be
+/// removed entirely.
+///
+/// ## Parameters
+///
+/// **from**:
+/// The file descriptor that needs to be copied.
+///
+/// **to**:
+/// The file descriptor that needs to be
+/// overwritten.
+#[inline]
+pub unsafe fn fd_replace(from_: fd, to_: fd) -> errno {
+  cloudabi_sys_fd_replace(from_, to_)
+}
+
+/// Moves the offset of the file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor whose offset has to be
+/// moved.
+///
+/// **offset**:
+/// The number of bytes to move.
+///
+/// **whence**:
+/// Relative to which position the move should
+/// take place.
+///
+/// **newoffset**:
+/// The new offset of the file descriptor,
+/// relative to the start of the file.
+#[inline]
+pub unsafe fn fd_seek(fd_: fd, offset_: filedelta, whence_: whence, newoffset_: &mut filesize) -> errno {
+  cloudabi_sys_fd_seek(fd_, offset_, whence_, newoffset_)
+}
+
+/// Gets attributes of a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor whose attributes have to
+/// be obtained.
+///
+/// **buf**:
+/// The buffer where the file descriptor's
+/// attributes are stored.
+#[inline]
+pub unsafe fn fd_stat_get(fd_: fd, buf_: *mut fdstat) -> errno {
+  cloudabi_sys_fd_stat_get(fd_, buf_)
+}
+
+/// Adjusts attributes of a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor whose attributes have to
+/// be adjusted.
+///
+/// **buf**:
+/// The desired values of the file descriptor
+/// attributes that are adjusted.
+///
+/// **flags**:
+/// A bitmask indicating which attributes have to
+/// be adjusted.
+#[inline]
+pub unsafe fn fd_stat_put(fd_: fd, buf_: *const fdstat, flags_: fdsflags) -> errno {
+  cloudabi_sys_fd_stat_put(fd_, buf_, flags_)
+}
+
+/// Synchronizes the data and metadata of a file to disk.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor of the file whose data
+/// and metadata needs to be synchronized to disk.
+#[inline]
+pub unsafe fn fd_sync(fd_: fd) -> errno {
+  cloudabi_sys_fd_sync(fd_)
+}
+
+/// Writes to a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor to which data should be
+/// written.
+///
+/// **iovs**:
+/// List of scatter/gather vectors where data
+/// should be retrieved.
+///
+/// **nwritten**:
+/// The number of bytes written.
+#[inline]
+pub unsafe fn fd_write(fd_: fd, iovs_: &[ciovec], nwritten_: &mut usize) -> errno {
+  cloudabi_sys_fd_write(fd_, iovs_.as_ptr(), iovs_.len(), nwritten_)
+}
+
+/// Provides file advisory information on a file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor for which to provide file
+/// advisory information.
+///
+/// **offset**:
+/// The offset within the file to which the
+/// advisory applies.
+///
+/// **len**:
+/// The length of the region to which the advisory
+/// applies.
+///
+/// **advice**:
+/// The advice.
+#[inline]
+pub unsafe fn file_advise(fd_: fd, offset_: filesize, len_: filesize, advice_: advice) -> errno {
+  cloudabi_sys_file_advise(fd_, offset_, len_, advice_)
+}
+
+/// Forces the allocation of space in a file.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file in which the space should be
+/// allocated.
+///
+/// **offset**:
+/// The offset at which the allocation should
+/// start.
+///
+/// **len**:
+/// The length of the area that is allocated.
+#[inline]
+pub unsafe fn file_allocate(fd_: fd, offset_: filesize, len_: filesize) -> errno {
+  cloudabi_sys_file_allocate(fd_, offset_, len_)
+}
+
+/// Creates a file of a specified type.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the file to be created starts.
+///
+/// **path**:
+/// The path at which the file should be created.
+///
+/// **type**:
+/// Possible values:
+///
+///   - [`DIRECTORY`](enum.filetype.html#variant.DIRECTORY):
+///     Creates a directory.
+#[inline]
+pub unsafe fn file_create(fd_: fd, path_: &[u8], type_: filetype) -> errno {
+  cloudabi_sys_file_create(fd_, path_.as_ptr(), path_.len(), type_)
+}
+
+/// Creates a hard link.
+///
+/// ## Parameters
+///
+/// **fd1**:
+/// The working directory at which the resolution
+/// of the source path starts.
+///
+/// **path1**:
+/// The source path of the file that should be
+/// hard linked.
+///
+/// **fd2**:
+/// The working directory at which the resolution
+/// of the destination path starts.
+///
+/// **path2**:
+/// The destination path at which the hard link
+/// should be created.
+#[inline]
+pub unsafe fn file_link(fd1_: lookup, path1_: &[u8], fd2_: fd, path2_: &[u8]) -> errno {
+  cloudabi_sys_file_link(fd1_, path1_.as_ptr(), path1_.len(), fd2_, path2_.as_ptr(), path2_.len())
+}
+
+/// Opens a file.
+///
+/// ## Parameters
+///
+/// **dirfd**:
+/// The working directory at which the resolution
+/// of the file to be opened starts.
+///
+/// **path**:
+/// The path of the file that should be opened.
+///
+/// **oflags**:
+/// The method at which the file should be opened.
+///
+/// **fds**:
+/// [`fdstat.fs_rights_base`](struct.fdstat.html#structfield.fs_rights_base) and
+/// [`fdstat.fs_rights_inheriting`](struct.fdstat.html#structfield.fs_rights_inheriting) specify the
+/// initial rights of the newly created file
+/// descriptor. The operating system is allowed to
+/// return a file descriptor with fewer rights
+/// than specified, if and only if those rights do
+/// not apply to the type of file being opened.
+///
+/// [`fdstat.fs_flags`](struct.fdstat.html#structfield.fs_flags) specifies the initial flags
+/// of the file descriptor.
+///
+/// [`fdstat.fs_filetype`](struct.fdstat.html#structfield.fs_filetype) is ignored.
+///
+/// **fd**:
+/// The file descriptor of the file that has been
+/// opened.
+#[inline]
+pub unsafe fn file_open(dirfd_: lookup, path_: &[u8], oflags_: oflags, fds_: *const fdstat, fd_: &mut fd) -> errno {
+  cloudabi_sys_file_open(dirfd_, path_.as_ptr(), path_.len(), oflags_, fds_, fd_)
+}
+
+/// Reads directory entries from a directory.
+///
+/// When successful, the contents of the output buffer consist of
+/// a sequence of directory entries. Each directory entry consists
+/// of a [`dirent`](struct.dirent.html) object, followed by [`dirent.d_namlen`](struct.dirent.html#structfield.d_namlen) bytes
+/// holding the name of the directory entry.
+///
+/// This system call fills the output buffer as much as possible,
+/// potentially truncating the last directory entry. This allows
+/// the caller to grow its read buffer size in case it's too small
+/// to fit a single large directory entry, or skip the oversized
+/// directory entry.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The directory from which to read the directory
+/// entries.
+///
+/// **buf**:
+/// The buffer where directory entries are stored.
+///
+/// **cookie**:
+/// The location within the directory to start
+/// reading.
+///
+/// **bufused**:
+/// The number of bytes stored in the read buffer.
+/// If less than the size of the read buffer, the
+/// end of the directory has been reached.
+#[inline]
+pub unsafe fn file_readdir(fd_: fd, buf_: &mut [u8], cookie_: dircookie, bufused_: &mut usize) -> errno {
+  cloudabi_sys_file_readdir(fd_, buf_.as_mut_ptr() as *mut (), buf_.len(), cookie_, bufused_)
+}
+
+/// Reads the contents of a symbolic link.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the path of the symbolic starts.
+///
+/// **path**:
+/// The path of the symbolic link whose contents
+/// should be read.
+///
+/// **buf**:
+/// The buffer where the contents of the symbolic
+/// link should be stored.
+///
+/// **bufused**:
+/// The number of bytes placed in the buffer.
+#[inline]
+pub unsafe fn file_readlink(fd_: fd, path_: &[u8], buf_: &mut [u8], bufused_: &mut usize) -> errno {
+  cloudabi_sys_file_readlink(fd_, path_.as_ptr(), path_.len(), buf_.as_mut_ptr(), buf_.len(), bufused_)
+}
+
+/// Renames a file.
+///
+/// ## Parameters
+///
+/// **fd1**:
+/// The working directory at which the resolution
+/// of the source path starts.
+///
+/// **path1**:
+/// The source path of the file that should be
+/// renamed.
+///
+/// **fd2**:
+/// The working directory at which the resolution
+/// of the destination path starts.
+///
+/// **path2**:
+/// The destination path to which the file should
+/// be renamed.
+#[inline]
+pub unsafe fn file_rename(fd1_: fd, path1_: &[u8], fd2_: fd, path2_: &[u8]) -> errno {
+  cloudabi_sys_file_rename(fd1_, path1_.as_ptr(), path1_.len(), fd2_, path2_.as_ptr(), path2_.len())
+}
+
+/// Gets attributes of a file by file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor whose attributes have to
+/// be obtained.
+///
+/// **buf**:
+/// The buffer where the file's attributes are
+/// stored.
+#[inline]
+pub unsafe fn file_stat_fget(fd_: fd, buf_: *mut filestat) -> errno {
+  cloudabi_sys_file_stat_fget(fd_, buf_)
+}
+
+/// Adjusts attributes of a file by file descriptor.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The file descriptor whose attributes have to
+/// be adjusted.
+///
+/// **buf**:
+/// The desired values of the file attributes that
+/// are adjusted.
+///
+/// **flags**:
+/// A bitmask indicating which attributes have to
+/// be adjusted.
+#[inline]
+pub unsafe fn file_stat_fput(fd_: fd, buf_: *const filestat, flags_: fsflags) -> errno {
+  cloudabi_sys_file_stat_fput(fd_, buf_, flags_)
+}
+
+/// Gets attributes of a file by path.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the path whose attributes have to be
+/// obtained starts.
+///
+/// **path**:
+/// The path of the file whose attributes have to
+/// be obtained.
+///
+/// **buf**:
+/// The buffer where the file's attributes are
+/// stored.
+#[inline]
+pub unsafe fn file_stat_get(fd_: lookup, path_: &[u8], buf_: *mut filestat) -> errno {
+  cloudabi_sys_file_stat_get(fd_, path_.as_ptr(), path_.len(), buf_)
+}
+
+/// Adjusts attributes of a file by path.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the path whose attributes have to be
+/// adjusted starts.
+///
+/// **path**:
+/// The path of the file whose attributes have to
+/// be adjusted.
+///
+/// **buf**:
+/// The desired values of the file attributes that
+/// are adjusted.
+///
+/// **flags**:
+/// A bitmask indicating which attributes have to
+/// be adjusted.
+#[inline]
+pub unsafe fn file_stat_put(fd_: lookup, path_: &[u8], buf_: *const filestat, flags_: fsflags) -> errno {
+  cloudabi_sys_file_stat_put(fd_, path_.as_ptr(), path_.len(), buf_, flags_)
+}
+
+/// Creates a symbolic link.
+///
+/// ## Parameters
+///
+/// **path1**:
+/// The contents of the symbolic link.
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the destination path starts.
+///
+/// **path2**:
+/// The destination path at which the symbolic
+/// link should be created.
+#[inline]
+pub unsafe fn file_symlink(path1_: &[u8], fd_: fd, path2_: &[u8]) -> errno {
+  cloudabi_sys_file_symlink(path1_.as_ptr(), path1_.len(), fd_, path2_.as_ptr(), path2_.len())
+}
+
+/// Unlinks a file, or removes a directory.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// The working directory at which the resolution
+/// of the path starts.
+///
+/// **path**:
+/// The path that needs to be unlinked or removed.
+///
+/// **flags**:
+/// Possible values:
+///
+///   - [`REMOVEDIR`](struct.ulflags.html#associatedconstant.REMOVEDIR):
+///     If set, attempt to remove a directory.
+///     Otherwise, unlink a file.
+#[inline]
+pub unsafe fn file_unlink(fd_: fd, path_: &[u8], flags_: ulflags) -> errno {
+  cloudabi_sys_file_unlink(fd_, path_.as_ptr(), path_.len(), flags_)
+}
+
+/// Unlocks a write-locked userspace lock.
+///
+/// If a userspace lock is unlocked while having its
+/// [`LOCK_KERNEL_MANAGED`](constant.LOCK_KERNEL_MANAGED.html) flag set, the lock cannot be unlocked in
+/// userspace directly. This system call needs to be performed
+/// instead, so that any waiting threads can be woken up.
+///
+/// To prevent spurious invocations of this system call, the lock
+/// must be locked for writing. This prevents other threads from
+/// acquiring additional read locks while the system call is in
+/// progress. If the lock is acquired for reading, it must first
+/// be upgraded to a write lock.
+///
+/// ## Parameters
+///
+/// **lock**:
+/// The userspace lock that is locked for writing
+/// by the calling thread.
+///
+/// **scope**:
+/// Whether the lock is stored in private or
+/// shared memory.
+#[inline]
+pub unsafe fn lock_unlock(lock_: *mut lock, scope_: scope) -> errno {
+  cloudabi_sys_lock_unlock(lock_, scope_)
+}
+
+/// Provides memory advisory information on a region of memory.
+///
+/// ## Parameters
+///
+/// **mapping**:
+/// The pages for which to provide memory advisory
+/// information.
+///
+/// **advice**:
+/// The advice.
+#[inline]
+pub unsafe fn mem_advise(mapping_: &mut [u8], advice_: advice) -> errno {
+  cloudabi_sys_mem_advise(mapping_.as_mut_ptr() as *mut (), mapping_.len(), advice_)
+}
+
+/// Creates a memory mapping, making the contents of a file
+/// accessible through memory.
+///
+/// ## Parameters
+///
+/// **addr**:
+/// If [`FIXED`](struct.mflags.html#associatedconstant.FIXED) is set, specifies to which
+/// address the file region is mapped. Otherwise,
+/// the mapping is performed at an unused
+/// location.
+///
+/// **len**:
+/// The length of the memory mapping to be
+/// created.
+///
+/// **prot**:
+/// Initial memory protection options for the
+/// memory mapping.
+///
+/// **flags**:
+/// Memory mapping flags.
+///
+/// **fd**:
+/// If [`ANON`](struct.mflags.html#associatedconstant.ANON) is set, this argument must be
+/// [`MAP_ANON_FD`](constant.MAP_ANON_FD.html). Otherwise, this argument
+/// specifies the file whose contents need to be
+/// mapped.
+///
+/// **off**:
+/// If [`ANON`](struct.mflags.html#associatedconstant.ANON) is set, this argument must be
+/// zero. Otherwise, this argument specifies the
+/// offset within the file at which the mapping
+/// starts.
+///
+/// **mem**:
+/// The starting address of the memory mapping.
+#[inline]
+pub unsafe fn mem_map(addr_: *mut (), len_: usize, prot_: mprot, flags_: mflags, fd_: fd, off_: filesize, mem_: &mut *mut ()) -> errno {
+  cloudabi_sys_mem_map(addr_, len_, prot_, flags_, fd_, off_, mem_)
+}
+
+/// Change the protection of a memory mapping.
+///
+/// ## Parameters
+///
+/// **mapping**:
+/// The pages that need their protection changed.
+///
+/// **prot**:
+/// New protection options.
+#[inline]
+pub unsafe fn mem_protect(mapping_: &mut [u8], prot_: mprot) -> errno {
+  cloudabi_sys_mem_protect(mapping_.as_mut_ptr() as *mut (), mapping_.len(), prot_)
+}
+
+/// Synchronize a region of memory with its physical storage.
+///
+/// ## Parameters
+///
+/// **mapping**:
+/// The pages that need to be synchronized.
+///
+/// **flags**:
+/// The method of synchronization.
+#[inline]
+pub unsafe fn mem_sync(mapping_: &mut [u8], flags_: msflags) -> errno {
+  cloudabi_sys_mem_sync(mapping_.as_mut_ptr() as *mut (), mapping_.len(), flags_)
+}
+
+/// Unmaps a region of memory.
+///
+/// ## Parameters
+///
+/// **mapping**:
+/// The pages that needs to be unmapped.
+#[inline]
+pub unsafe fn mem_unmap(mapping_: &mut [u8]) -> errno {
+  cloudabi_sys_mem_unmap(mapping_.as_mut_ptr() as *mut (), mapping_.len())
+}
+
+/// Concurrently polls for the occurrence of a set of events.
+///
+/// ## Parameters
+///
+/// **in**:
+/// The events to which to subscribe.
+///
+/// **out**:
+/// The events that have occurred.
+///
+/// **nsubscriptions**:
+/// Both the number of subscriptions and events.
+///
+/// **nevents**:
+/// The number of events stored.
+#[inline]
+pub unsafe fn poll(in_: *const subscription, out_: *mut event, nsubscriptions_: usize, nevents_: &mut usize) -> errno {
+  cloudabi_sys_poll(in_, out_, nsubscriptions_, nevents_)
+}
+
+/// Replaces the process by a new executable.
+///
+/// Process execution in CloudABI differs from POSIX in two ways:
+/// handling of arguments and inheritance of file descriptors.
+///
+/// CloudABI does not use string command line arguments. Instead,
+/// a buffer with binary data is copied into the address space of
+/// the new executable. The kernel does not enforce any specific
+/// structure to this data, although CloudABI's C library uses it
+/// to store a tree structure that is semantically identical to
+/// YAML.
+///
+/// Due to the strong focus on thread safety, file descriptors
+/// aren't inherited through close-on-exec flags. An explicit
+/// list of file descriptors that need to be retained needs to be
+/// provided. After execution, file descriptors are placed in the
+/// order in which they are stored in the array. This not only
+/// makes the execution process deterministic. It also prevents
+/// potential information disclosures about the layout of the
+/// original process.
+///
+/// ## Parameters
+///
+/// **fd**:
+/// A file descriptor of the new executable.
+///
+/// **data**:
+/// Binary argument data that is passed on to the
+/// new executable.
+///
+/// **fds**:
+/// The layout of the file descriptor table after
+/// execution.
+#[inline]
+pub unsafe fn proc_exec(fd_: fd, data_: &[u8], fds_: &[fd]) -> errno {
+  cloudabi_sys_proc_exec(fd_, data_.as_ptr() as *const (), data_.len(), fds_.as_ptr(), fds_.len())
+}
+
+/// Terminates the process normally.
+///
+/// ## Parameters
+///
+/// **rval**:
+/// The exit code returned by the process. The
+/// exit code can be obtained by other processes
+/// through [`event.union.proc_terminate.exitcode`](struct.event_proc_terminate.html#structfield.exitcode).
+#[inline]
+pub unsafe fn proc_exit(rval_: exitcode) -> ! {
+  cloudabi_sys_proc_exit(rval_)
+}
+
+/// Forks the process of the calling thread.
+///
+/// After forking, a new process shall be created, having only a
+/// copy of the calling thread. The parent process will obtain a
+/// process descriptor. When closed, the child process is
+/// automatically signaled with [`KILL`](enum.signal.html#variant.KILL).
+///
+/// ## Parameters
+///
+/// **fd**:
+/// In the parent process: the file descriptor
+/// number of the process descriptor.
+///
+/// In the child process: [`PROCESS_CHILD`](constant.PROCESS_CHILD.html).
+///
+/// **tid**:
+/// In the parent process: undefined.
+///
+/// In the child process: the thread ID of the
+/// initial thread of the child process.
+#[inline]
+pub unsafe fn proc_fork(fd_: &mut fd, tid_: &mut tid) -> errno {
+  cloudabi_sys_proc_fork(fd_, tid_)
+}
+
+/// Sends a signal to the process of the calling thread.
+///
+/// ## Parameters
+///
+/// **sig**:
+/// The signal condition that should be triggered.
+/// If the signal causes the process to terminate,
+/// its condition can be obtained by other
+/// processes through
+/// [`event.union.proc_terminate.signal`](struct.event_proc_terminate.html#structfield.signal).
+#[inline]
+pub unsafe fn proc_raise(sig_: signal) -> errno {
+  cloudabi_sys_proc_raise(sig_)
+}
+
+/// Obtains random data from the kernel random number generator.
+///
+/// As this interface is not guaranteed to be fast, it is advised
+/// that the random data obtained through this system call is used
+/// as the seed for a userspace pseudo-random number generator.
+///
+/// ## Parameters
+///
+/// **buf**:
+/// The buffer that needs to be filled with random
+/// data.
+#[inline]
+pub unsafe fn random_get(buf_: &mut [u8]) -> errno {
+  cloudabi_sys_random_get(buf_.as_mut_ptr() as *mut (), buf_.len())
+}
+
+/// Receives a message on a socket.
+///
+/// ## Parameters
+///
+/// **sock**:
+/// The socket on which a message should be
+/// received.
+///
+/// **in**:
+/// Input parameters.
+///
+/// **out**:
+/// Output parameters.
+#[inline]
+pub unsafe fn sock_recv(sock_: fd, in_: *const recv_in, out_: *mut recv_out) -> errno {
+  cloudabi_sys_sock_recv(sock_, in_, out_)
+}
+
+/// Sends a message on a socket.
+///
+/// ## Parameters
+///
+/// **sock**:
+/// The socket on which a message should be sent.
+///
+/// **in**:
+/// Input parameters.
+///
+/// **out**:
+/// Output parameters.
+#[inline]
+pub unsafe fn sock_send(sock_: fd, in_: *const send_in, out_: *mut send_out) -> errno {
+  cloudabi_sys_sock_send(sock_, in_, out_)
+}
+
+/// Shuts down socket send and receive channels.
+///
+/// ## Parameters
+///
+/// **sock**:
+/// The socket that needs its channels shut down.
+///
+/// **how**:
+/// Which channels on the socket need to be shut
+/// down.
+#[inline]
+pub unsafe fn sock_shutdown(sock_: fd, how_: sdflags) -> errno {
+  cloudabi_sys_sock_shutdown(sock_, how_)
+}
+
+/// Creates a new thread within the current process.
+///
+/// ## Parameters
+///
+/// **attr**:
+/// The desired attributes of the new thread.
+///
+/// **tid**:
+/// The thread ID of the new thread.
+#[inline]
+pub unsafe fn thread_create(attr_: *mut threadattr, tid_: &mut tid) -> errno {
+  cloudabi_sys_thread_create(attr_, tid_)
+}
+
+/// Terminates the calling thread.
+///
+/// This system call can also unlock a single userspace lock
+/// after termination, which can be used to implement thread
+/// joining.
+///
+/// ## Parameters
+///
+/// **lock**:
+/// Userspace lock that is locked for writing by
+/// the calling thread.
+///
+/// **scope**:
+/// Whether the lock is stored in private or
+/// shared memory.
+#[inline]
+pub unsafe fn thread_exit(lock_: *mut lock, scope_: scope) -> ! {
+  cloudabi_sys_thread_exit(lock_, scope_)
+}
+
+/// Temporarily yields execution of the calling thread.
+#[inline]
+pub unsafe fn thread_yield() -> errno {
+  cloudabi_sys_thread_yield()
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/fuchsia-cprng/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{"AUTHORS":"f82920a5bcfc71b86c1de4be4cdea8af2009ba9e5735824f95ed5043a03e46f0","Cargo.toml":"bb2497b2907c3af499ce7ac3722dae044968e13409a372b7760150f8a01c74c5","LICENSE":"03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b","PATENTS":"52beb3ac72a0e7f5060384d16e4e6f91573016448fbff363c0b01a66fe99f547","src/lib.rs":"3d76c35c13203093ddf7ce2a3be5e98d768a8091cd9d99bd083fe8db35364096"},"package":"a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/fuchsia-cprng/AUTHORS
@@ -0,0 +1,10 @@
+# This is the list of Fuchsia Authors.
+
+# Names should be added to this file as one of
+#     Organization's name
+#     Individual's name <submission email address>
+#     Individual's name <submission email address> <email2> <emailN>
+
+Google Inc.
+The Chromium Authors
+The Go Authors
copy from third_party/rust/httparse/Cargo.toml
copy to third_party/rust/fuchsia-cprng/Cargo.toml
--- a/third_party/rust/httparse/Cargo.toml
+++ b/third_party/rust/fuchsia-cprng/Cargo.toml
@@ -6,24 +6,17 @@
 # to registry (e.g. crates.io) dependencies
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
-name = "httparse"
-version = "1.2.3"
-authors = ["Sean McArthur <sean.monstar@gmail.com>"]
-description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
-license = "MIT/Apache-2.0"
-repository = "https://github.com/seanmonstar/httparse"
-[profile.bench]
-opt-level = 3
-lto = true
-codegen-units = 1
-[dev-dependencies.pico-sys]
-version = "0.0"
-
-[features]
-default = ["std"]
-std = []
+edition = "2018"
+name = "fuchsia-cprng"
+version = "0.1.1"
+authors = ["Erick Tryzelaar <etryzelaar@google.com>"]
+include = ["src/*.rs", "Cargo.toml", "AUTHORS", "LICENSE", "PATENTS"]
+description = "Rust crate for the Fuchsia cryptographically secure pseudorandom number generator"
+readme = "README.md"
+license-file = "LICENSE"
+repository = "https://fuchsia.googlesource.com/fuchsia/+/master/garnet/public/rust/fuchsia-cprng"
rename from third_party/rust/sha1/LICENSE
rename to third_party/rust/fuchsia-cprng/LICENSE
--- a/third_party/rust/sha1/LICENSE
+++ b/third_party/rust/fuchsia-cprng/LICENSE
@@ -1,29 +1,23 @@
-Copyright (c) 2014 by Armin Ronacher.
-
-Copyright (c) 2013 Koka El Kiwi
-
-Some rights reserved.
+Copyright 2019 The Fuchsia Authors. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 met:
 
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-
-    * The names of the contributors may not be used to endorse or
-      promote products derived from this software without specific
-      prior written permission.
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
new file mode 100644
--- /dev/null
+++ b/third_party/rust/fuchsia-cprng/PATENTS
@@ -0,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the Fuchsia project.
+
+Google hereby grants to you a perpetual, worldwide, non-exclusive,
+no-charge, royalty-free, irrevocable (except as stated in this
+section) patent license to make, have made, use, offer to sell, sell,
+import, transfer, and otherwise run, modify and propagate the contents
+of this implementation of Fuchsia, where such license applies only to
+those patent claims, both currently owned by Google and acquired in
+the future, licensable by Google that are necessarily infringed by
+this implementation. This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation. If you or your agent or exclusive licensee institute
+or order or agree to the institution of patent litigation or any other
+patent enforcement activity against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that this
+implementation of Fuchsia constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of
+Fuchsia shall terminate as of the date such litigation is filed.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/fuchsia-cprng/src/lib.rs
@@ -0,0 +1,57 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+//! Type-safe bindings for the Zircon kernel's CPRNG.
+
+#![no_std]
+#![deny(warnings)]
+
+/// Draw random bytes from the kernel's CPRNG to fill the given buffer.
+///
+/// Wraps the
+/// [zx_cprng_draw](https://fuchsia.googlesource.com/fuchsia/+/master/zircon/docs/syscalls/cprng_draw.md)
+/// syscall.
+pub fn cprng_draw(buffer: &mut [u8]) {
+    unsafe { zx_cprng_draw(buffer.as_mut_ptr(), buffer.len()) };
+}
+
+#[link(name = "zircon")]
+extern "C" {
+    fn zx_cprng_draw(buffer: *mut u8, length: usize);
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn cprng() {
+        let mut buffer = [0; 20];
+        cprng_draw(&mut buffer);
+        let mut first_zero = 0;
+        let mut last_zero = 0;
+        for _ in 0..30 {
+            let mut buffer = [0; 20];
+            cprng_draw(&mut buffer);
+            if buffer[0] == 0 {
+                first_zero += 1;
+            }
+            if buffer[19] == 0 {
+                last_zero += 1;
+            }
+        }
+        assert_ne!(first_zero, 30);
+        assert_ne!(last_zero, 30);
+    }
+
+    #[test]
+    fn cprng_large() {
+        let mut buffer = [0; 1024];
+        cprng_draw(&mut buffer);
+
+        for mut s in buffer.chunks_mut(256) {
+            cprng_draw(&mut s);
+        }
+    }
+}
--- a/third_party/rust/httparse/.cargo-checksum.json
+++ b/third_party/rust/httparse/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"ce89721483a37a5e21e4c7c8bd36b64a03067c23b3c6a9569e552a2a0364522e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ad5ce29918424008bdd8c6e7851bb064533456cbb32ec0d0955b2bc9444613d3","README.md":"8777517c90cff609e5a00a46b548f44803a4943cc7430a0ca6ddc4712af8d4ac","benches/parse.rs":"07f7d63b625090f1ccb086679e24c104de450d8733bb517e38a6eda8511e35e3","src/iter.rs":"9782faa1736e7988feceecdd5169f51b8b7926cbcf6611bbef9e018763e3cec8","src/lib.rs":"d95d4de02b19f2f921e13f0f477092d202fe0e707dc007b9bbd05282d7e69ebc"},"package":"af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07"}
\ No newline at end of file
+{"files":{"Cargo.toml":"2d893bf5d1e9a5445e74c2a7a75b804492245647004155a798f5456e5c0f4712","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ad5ce29918424008bdd8c6e7851bb064533456cbb32ec0d0955b2bc9444613d3","README.md":"b54e1e379daa12d26aadad7c1bef578a3cbcf243f2f229d8b17868c90a384d7d","benches/parse.rs":"caabd31cbcb00172bb7f31a1398dbed27a3bf36b01d69729c3d6fbd9a4008e05","build.rs":"00bab146ec6a10fac91958a06bdd4b7b4d71932e0480b6e84a4248cb339dbe79","src/iter.rs":"3f165be2f0d3bb7e0cbe37cb67560e36e06cdb5921e145446a5985c3580a6b6e","src/lib.rs":"21436cacd3b33b20ad75877e6260f34391a9215ffa6ad2c10ebf1a0c67ac07dc","src/macros.rs":"25de190f894eefb48a6992f9dc3d039d9065f908f381d683f0395d568d992275","src/simd/avx2.rs":"1b27cad7b5c210f8a1283d423ca18372127ea50f5565b9be0b83d2a51a1eb826","src/simd/fallback.rs":"0234cc11459f3225d6e3d329068a01206e39625a538bdc292e0d1beaa06a37e5","src/simd/mod.rs":"c67e118a45da679d41de0d51c2f632f64902083db4be8f636021dbfe08f0f9b4","src/simd/sse42.rs":"373f5bf0596942b9ba4497a8a89975117ec0da6d8b8c2345fe03e0d28e68627f","tests/uri.rs":"92a0dc4cfa8eee2e6b8e9109e2e0062ccb50b9ec8cb4b7c06794dab1a3e68c9c"},"package":"e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83"}
\ No newline at end of file
--- a/third_party/rust/httparse/Cargo.toml
+++ b/third_party/rust/httparse/Cargo.toml
@@ -7,19 +7,24 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "httparse"
-version = "1.2.3"
-authors = ["Sean McArthur <sean.monstar@gmail.com>"]
+version = "1.3.3"
+authors = ["Sean McArthur <sean@seanmonstar.com>"]
+build = "build.rs"
 description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
+documentation = "https://docs.rs/httparse"
+readme = "README.md"
+keywords = ["http", "parser", "no_std"]
+categories = ["network-programming", "no-std", "parser-implementations", "web-programming"]
 license = "MIT/Apache-2.0"
 repository = "https://github.com/seanmonstar/httparse"
 [profile.bench]
 opt-level = 3
 lto = true
 codegen-units = 1
 [dev-dependencies.pico-sys]
 version = "0.0"
--- a/third_party/rust/httparse/README.md
+++ b/third_party/rust/httparse/README.md
@@ -1,31 +1,34 @@
 # httparse
 
 [![Build Status](https://travis-ci.org/seanmonstar/httparse.svg?branch=master)](https://travis-ci.org/seanmonstar/httparse)
 [![Coverage Status](https://coveralls.io/repos/seanmonstar/httparse/badge.svg)](https://coveralls.io/r/seanmonstar/httparse)
-[![crates.io](http://meritbadge.herokuapp.com/httparse)](https://crates.io/crates/httparse)
+[![crates.io](https://img.shields.io/crates/v/httparse.svg)](https://crates.io/crates/httparse)
 
-A push parser for the HTTP 1.x protocol. Avoids allocations. Fast.
+A push parser for the HTTP 1.x protocol. Avoids allocations. No copy. **Fast.**
+
+Works with `no_std`, simply disable the `std` Cargo feature.
 
 [Documentation](https://docs.rs/httparse)
+[Changelog](https://github.com/seanmonstar/httparse/releases)
 
 ## Usage
 
 ```rust
 let mut headers = [httparse::EMPTY_HEADER; 16];
 let mut req = httparse::Request::new(&mut headers);
 
 let buf = b"GET /index.html HTTP/1.1\r\nHost";
-assert!(try!(req.parse(buf)).is_partial());
+assert!(req.parse(buf)?.is_partial());
 
 // a partial request, so we try again once we have more data
 
 let buf = b"GET /index.html HTTP/1.1\r\nHost: example.domain\r\n\r\n";
-assert!(try!(req.parse(buf)).is_complete());
+assert!(req.parse(buf)?.is_complete());
 ```
 
 ## License
 
 Licensed under either of
 
 - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
 - MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
--- a/third_party/rust/httparse/benches/parse.rs
+++ b/third_party/rust/httparse/benches/parse.rs
@@ -1,28 +1,31 @@
 #![feature(test)]
 
 extern crate pico_sys as pico;
 extern crate httparse;
 
 extern crate test;
 
+const REQ_SHORT: &'static [u8] = b"\
+GET / HTTP/1.0\r\n\
+Host: example.com\r\n\
+Cookie: session=60; user_id=1\r\n\r\n";
+
 const REQ: &'static [u8] = b"\
 GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n\
 Host: www.kittyhell.com\r\n\
 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\n\
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n\
 Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n\
 Accept-Encoding: gzip,deflate\r\n\
 Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n\
 Keep-Alive: 115\r\n\
 Connection: keep-alive\r\n\
-Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n\r\n";
-
-
+Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral|padding=under256\r\n\r\n";
 
 
 #[bench]
 fn bench_pico(b: &mut test::Bencher) {
     use std::mem;
 
     #[repr(C)]
     #[derive(Clone, Copy)]
@@ -63,8 +66,57 @@ fn bench_pico(b: &mut test::Bencher) {
 fn bench_httparse(b: &mut test::Bencher) {
     let mut headers = [httparse::Header{ name: "", value: &[] }; 16];
     let mut req = httparse::Request::new(&mut headers);
     b.iter(|| {
         assert_eq!(req.parse(REQ).unwrap(), httparse::Status::Complete(REQ.len()));
     });
     b.bytes = REQ.len() as u64;
 }
+
+#[bench]
+fn bench_pico_short(b: &mut test::Bencher) {
+    use std::mem;
+
+    #[repr(C)]
+    #[derive(Clone, Copy)]
+    struct Header<'a>(&'a [u8], &'a [u8]);
+
+
+    #[repr(C)]
+    struct Headers<'a>(&'a mut [Header<'a>]);
+    let method = [0i8; 16];
+    let path = [0i8; 16];
+    let mut minor_version = 0;
+    let mut h = [Header(&[], &[]); 16];
+    let mut h_len = h.len();
+    let headers = Headers(&mut h);
+    let prev_buf_len = 0;
+
+    b.iter(|| {
+        let ret = unsafe {
+            pico::ffi::phr_parse_request(
+                REQ_SHORT.as_ptr() as *const _,
+                REQ_SHORT.len(),
+                &mut method.as_ptr(),
+                &mut 16,
+                &mut path.as_ptr(),
+                &mut 16,
+                &mut minor_version,
+                mem::transmute::<*mut Header, *mut pico::ffi::phr_header>(headers.0.as_mut_ptr()),
+                &mut h_len as *mut usize as *mut _,
+                prev_buf_len
+            )
+        };
+        assert_eq!(ret, REQ_SHORT.len() as i32);
+    });
+    b.bytes = REQ_SHORT.len() as u64;
+}
+
+#[bench]
+fn bench_httparse_short(b: &mut test::Bencher) {
+    let mut headers = [httparse::Header{ name: "", value: &[] }; 16];
+    let mut req = httparse::Request::new(&mut headers);
+    b.iter(|| {
+        assert_eq!(req.parse(REQ_SHORT).unwrap(), httparse::Status::Complete(REQ_SHORT.len()));
+    });
+    b.bytes = REQ_SHORT.len() as u64;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/build.rs
@@ -0,0 +1,155 @@
+use std::env;
+use std::ffi::OsString;
+use std::process::Command;
+
+fn main() {
+    let rustc = env::var_os("RUSTC").unwrap_or(OsString::from("rustc"));
+    let output = Command::new(&rustc)
+        .arg("--version")
+        .output()
+        .expect("failed to check 'rustc --version'")
+        .stdout;
+
+    let version = String::from_utf8(output)
+        .expect("rustc version output should be utf-8");
+
+    enable_new_features(&version);
+}
+
+fn enable_new_features(raw_version: &str) {
+    let version = match Version::parse(raw_version) {
+        Ok(version) => version,
+        Err(err) => {
+            println!("cargo:warning=failed to parse `rustc --version`: {}", err);
+            return;
+        }
+    };
+
+    enable_simd(version);
+}
+
+fn enable_simd(version: Version) {
+    if env::var_os("CARGO_FEATURE_STD").is_none() {
+        println!("cargo:warning=building for no_std disables httparse SIMD");
+        return;
+    }
+
+    let env_disable = "CARGO_CFG_HTTPARSE_DISABLE_SIMD";
+    if env::var_os(env_disable).is_some() {
+        println!("cargo:warning=detected {} environment variable, disabling SIMD", env_disable);
+        return;
+    }
+
+    let min_simd_version = Version {
+        major: 1,
+        minor: 27,
+        patch: 0,
+    };
+
+    if version >= min_simd_version {
+        println!("cargo:rustc-cfg=httparse_simd");
+    }
+
+    // cfg(target_feature) isn't stable yet, but CARGO_CFG_TARGET_FEATURE has
+    // a list... We aren't doing anything unsafe, since the is_x86_feature_detected
+    // macro still checks in the actual lib, BUT!
+    //
+    // By peeking at the list here, we can change up slightly how we do feature
+    // detection in the lib. If our features aren't in the feature list, we
+    // stick with a cached runtime detection strategy.
+    //
+    // But if the features *are* in the list, we benefit from removing our cache,
+    // since the compiler will eliminate several branches with its internal
+    // cfg(target_feature) usage.
+
+
+    let env_runtime_only = "CARGO_CFG_HTTPARSE_DISABLE_SIMD_COMPILETIME";
+    if env::var_os(env_runtime_only).is_some() {
+        println!("cargo:warning=detected {} environment variable, using runtime SIMD detection only", env_runtime_only);
+        return;
+    }
+    let feature_list = match env::var_os("CARGO_CFG_TARGET_FEATURE") {
+        Some(var) => match var.into_string() {
+            Ok(s) => s,
+            Err(_) => {
+                println!("cargo:warning=CARGO_CFG_TARGET_FEATURE was not valid utf-8");
+                return;
+            },
+        },
+        None => {
+            println!("cargo:warning=CARGO_CFG_TARGET_FEATURE was not set");
+            return
+        },
+    };
+
+    let mut saw_sse42 = false;
+    let mut saw_avx2 = false;
+
+    for feature in feature_list.split(',') {
+        let feature = feature.trim();
+        if !saw_sse42 && feature == "sse4.2" {
+            saw_sse42 = true;
+            println!("cargo:rustc-cfg=httparse_simd_target_feature_sse42");
+        }
+
+        if !saw_avx2 && feature == "avx2" {
+            saw_avx2 = true;
+            println!("cargo:rustc-cfg=httparse_simd_target_feature_avx2");
+        }
+    }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
+struct Version {
+    major: u32,
+    minor: u32,
+    patch: u32,
+}
+
+impl Version {
+    fn parse(mut s: &str) -> Result<Version, String> {
+        if !s.starts_with("rustc ") {
+            return Err(format!("unrecognized version string: {}", s));
+        }
+        s = &s["rustc ".len()..];
+
+        let parts: Vec<&str> = s.split(".").collect();
+        if parts.len() < 3 {
+            return Err(format!("not enough version parts: {:?}", parts));
+        }
+
+        let mut num = String::new();
+        for c in parts[0].chars() {
+            if !c.is_digit(10) {
+                break;
+            }
+            num.push(c);
+        }
+        let major = try!(num.parse::<u32>().map_err(|e| e.to_string()));
+
+        num.clear();
+        for c in parts[1].chars() {
+            if !c.is_digit(10) {
+                break;
+            }
+            num.push(c);
+        }
+        let minor = try!(num.parse::<u32>().map_err(|e| e.to_string()));
+
+        num.clear();
+        for c in parts[2].chars() {
+            if !c.is_digit(10) {
+                break;
+            }
+            num.push(c);
+        }
+        let patch = try!(num.parse::<u32>().map_err(|e| e.to_string()));
+
+        Ok(Version {
+            major: major,
+            minor: minor,
+            patch: patch,
+        })
+    }
+}
+
--- a/third_party/rust/httparse/src/iter.rs
+++ b/third_party/rust/httparse/src/iter.rs
@@ -20,54 +20,70 @@ impl<'a> Bytes<'a> {
     }
 
     #[inline]
     pub fn peek(&self) -> Option<u8> {
         self.slice.get(self.pos).cloned()
     }
 
     #[inline]
-    pub fn bump(&mut self) {
+    pub unsafe fn bump(&mut self) {
+        debug_assert!(self.pos + 1 <= self.slice.len(), "overflow");
         self.pos += 1;
     }
 
+    #[allow(unused)]
+    #[inline]
+    pub unsafe fn advance(&mut self, n: usize) {
+        debug_assert!(self.pos + n <= self.slice.len(), "overflow");
+        self.pos += n;
+    }
+
     #[inline]
     pub fn len(&self) -> usize {
         self.slice.len()
     }
 
     #[inline]
     pub fn slice(&mut self) -> &'a [u8] {
-        self.slice_skip(0)
+        // not moving position at all, so it's safe
+        unsafe {
+            self.slice_skip(0)
+        }
     }
 
     #[inline]
-    pub fn slice_skip(&mut self, skip: usize) -> &'a [u8] {
+    pub unsafe fn slice_skip(&mut self, skip: usize) -> &'a [u8] {
         debug_assert!(self.pos >= skip);
         let head_pos = self.pos - skip;
-        unsafe {
-            let ptr = self.slice.as_ptr();
-            let head = slice::from_raw_parts(ptr, head_pos);
-            let tail = slice::from_raw_parts(ptr.offset(self.pos as isize), self.slice.len() - self.pos);
-            self.pos = 0;
-            self.slice = tail;
-            head
-        }
+        let ptr = self.slice.as_ptr();
+        let head = slice::from_raw_parts(ptr, head_pos);
+        let tail = slice::from_raw_parts(ptr.offset(self.pos as isize), self.slice.len() - self.pos);
+        self.pos = 0;
+        self.slice = tail;
+        head
     }
 
     #[inline]
     pub fn next_8<'b>(&'b mut self) -> Option<Bytes8<'b, 'a>> {
         if self.slice.len() > self.pos + 8 {
             Some(Bytes8::new(self))
         } else {
             None
         }
     }
 }
 
+impl<'a> AsRef<[u8]> for Bytes<'a> {
+    #[inline]
+    fn as_ref(&self) -> &[u8] {
+        &self.slice[self.pos..]
+    }
+}
+
 impl<'a> Iterator for Bytes<'a> {
     type Item = u8;
 
     #[inline]
     fn next(&mut self) -> Option<u8> {
         if self.slice.len() > self.pos {
             let b = unsafe { *self.slice.get_unchecked(self.pos) };
             self.pos += 1;
--- a/third_party/rust/httparse/src/lib.rs
+++ b/third_party/rust/httparse/src/lib.rs
@@ -1,58 +1,41 @@
-#![cfg_attr(not(feature = "std"),  no_std)]
+#![doc(html_root_url = "https://docs.rs/httparse/1.3.3")]
+#![cfg_attr(not(feature = "std"), no_std)]
 #![cfg_attr(test, deny(warnings))]
 #![deny(missing_docs)]
+
 //! # httparse
 //!
 //! A push library for parsing HTTP/1.x requests and responses.
 //!
 //! The focus is on speed and safety. Unsafe code is used to keep parsing fast,
 //! but unsafety is contained in a submodule, with invariants enforced. The
 //! parsing internals use an `Iterator` instead of direct indexing, while
 //! skipping bounds checks.
 //!
-//! The speed is faster than picohttpparser, when SIMD is not available.
-#[cfg(feature = "std")] extern crate std as core;
+//! With Rust 1.27.0 or later, support for SIMD is enabled automatically.
+//! If building an executable to be run on multiple platforms, and thus
+//! not passing `target_feature` or `target_cpu` flags to the compiler,
+//! runtime detection can still detect SSE4.2 or AVX2 support to provide
+//! massive wins.
+//!
+//! If compiling for a specific target, remembering to include
+//! `-C target_cpu=native` allows the detection to become compile time checks,
+//! making it *even* faster.
+#[cfg(feature = "std")]
+extern crate std as core;
 
 use core::{fmt, result, str, slice};
 
 use iter::Bytes;
 
 mod iter;
-
-macro_rules! next {
-    ($bytes:ident) => ({
-        match $bytes.next() {
-            Some(b) => b,
-            None => return Ok(Status::Partial)
-        }
-    })
-}
-
-macro_rules! expect {
-    ($bytes:ident.next() == $pat:pat => $ret:expr) => {
-        expect!(next!($bytes) => $pat |? $ret)
-    };
-    ($e:expr => $pat:pat |? $ret:expr) => {
-        match $e {
-            v@$pat => v,
-            _ => return $ret
-        }
-    };
-}
-
-macro_rules! complete {
-    ($e:expr) => {
-        match try!($e) {
-            Status::Complete(v) => v,
-            Status::Partial => return Ok(Status::Partial)
-        }
-    }
-}
+#[macro_use] mod macros;
+mod simd;
 
 #[inline]
 fn shrink<T>(slice: &mut &mut [T], len: usize) {
     debug_assert!(slice.len() >= len);
     let ptr = slice.as_mut_ptr();
     *slice = unsafe { slice::from_raw_parts_mut(ptr, len) };
 }
 
@@ -65,20 +48,51 @@ fn shrink<T>(slice: &mut &mut [T], len: 
 /// >                / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
 /// >                / DIGIT / ALPHA
 /// >                ; any VCHAR, except delimiters
 /// > ```
 #[inline]
 fn is_token(b: u8) -> bool {
     b > 0x1F && b < 0x7F
 }
-macro_rules! byte_map {
-    ($($flag:expr,)*) => ([
-        $($flag != 0,)*
-    ])
+
+// ASCII codes to accept URI string.
+// i.e. A-Z a-z 0-9 !#$%&'*+-._();:@=,/?[]~^
+// TODO: Make a stricter checking for URI string?
+static URI_MAP: [bool; 256] = byte_map![
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+//  \0                            \n
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+//  commands
+    0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+//  \w !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
+//  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+//  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
+//  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+//  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+//  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  del
+//   ====== Extended ASCII (aka. obs-text) ======
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+];
+
+#[inline]
+fn is_uri_token(b: u8) -> bool {
+    URI_MAP[b as usize]
 }
 
 static HEADER_NAME_MAP: [bool; 256] = byte_map![
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
     0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -96,17 +110,17 @@ static HEADER_NAME_MAP: [bool; 256] = by
 ];
 
 #[inline]
 fn is_header_name_token(b: u8) -> bool {
     HEADER_NAME_MAP[b as usize]
 }
 
 static HEADER_VALUE_MAP: [bool; 256] = byte_map![
-    0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -120,39 +134,16 @@ static HEADER_VALUE_MAP: [bool; 256] = b
 ];
 
 
 #[inline]
 fn is_header_value_token(b: u8) -> bool {
     HEADER_VALUE_MAP[b as usize]
 }
 
-
-macro_rules! space {
-    ($bytes:ident or $err:expr) => ({
-        expect!($bytes.next() == b' ' => Err($err));
-        $bytes.slice();
-    })
-}
-
-macro_rules! newline {
-    ($bytes:ident) => ({
-        match next!($bytes) {
-            b'\r' => {
-                expect!($bytes.next() == b'\n' => Err(Error::NewLine));
-                $bytes.slice();
-            },
-            b'\n' => {
-                $bytes.slice();
-            },
-            _ => return Err(Error::NewLine)
-        }
-    })
-}
-
 /// An error in parsing.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum Error {
     /// Invalid byte in header name.
     HeaderName,
     /// Invalid byte in header value.
     HeaderValue,
     /// Invalid byte in new line.
@@ -306,38 +297,40 @@ impl<'h, 'b> Request<'h, 'b> {
     }
 
     /// Try to parse a buffer of bytes into the Request.
     pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
         let orig_len = buf.len();
         let mut bytes = Bytes::new(buf);
         complete!(skip_empty_lines(&mut bytes));
         self.method = Some(complete!(parse_token(&mut bytes)));
-        self.path = Some(complete!(parse_token(&mut bytes)));
+        self.path = Some(complete!(parse_uri(&mut bytes)));
         self.version = Some(complete!(parse_version(&mut bytes)));
         newline!(bytes);
 
         let len = orig_len - bytes.len();
         let headers_len = complete!(parse_headers_iter(&mut self.headers, &mut bytes));
 
         Ok(Status::Complete(len + headers_len))
     }
 }
 
 #[inline]
 fn skip_empty_lines(bytes: &mut Bytes) -> Result<()> {
     loop {
         let b = bytes.peek();
         match b {
             Some(b'\r') => {
-                bytes.bump();
+                // there's `\r`, so it's safe to bump 1 pos
+                unsafe { bytes.bump() };
                 expect!(bytes.next() == b'\n' => Err(Error::NewLine));
             },
             Some(b'\n') => {
-                bytes.bump();
+                // there's `\n`, so it's safe to bump 1 pos
+                unsafe { bytes.bump(); }
             },
             Some(..) => {
                 bytes.slice();
                 return Ok(Status::Complete(()));
             },
             None => return Ok(Status::Partial)
         }
     }
@@ -391,16 +384,17 @@ impl<'h, 'b> Response<'h, 'b> {
         // Anything else we'll say is a malformed status.
         match next!(bytes) {
             b' ' => {
                 bytes.slice();
                 self.reason = Some(complete!(parse_reason(&mut bytes)));
             },
             b'\r' => {
                 expect!(bytes.next() == b'\n' => Err(Error::Status));
+                bytes.slice();
                 self.reason = Some("");
             },
             b'\n' => self.reason = Some(""),
             _ => return Err(Error::Status),
         }
 
 
         let len = orig_len - bytes.len();
@@ -443,20 +437,31 @@ fn parse_version(bytes: &mut Bytes) -> R
         expect!(eight._4() => b'/' |? Err(Error::Version));
         expect!(eight._5() => b'1' |? Err(Error::Version));
         expect!(eight._6() => b'.' |? Err(Error::Version));
         let v = match eight._7() {
             b'0' => 0,
             b'1' => 1,
             _ => return Err(Error::Version)
         };
-        Ok(Status::Complete(v))
-    } else {
-        Ok(Status::Partial)
+        return Ok(Status::Complete(v))
     }
+
+    // else (but not in `else` because of borrow checker)
+
+    // If there aren't at least 8 bytes, we still want to detect early
+    // if this is a valid version or not. If it is, we'll return Partial.
+    expect!(bytes.next() == b'H' => Err(Error::Version));
+    expect!(bytes.next() == b'T' => Err(Error::Version));
+    expect!(bytes.next() == b'T' => Err(Error::Version));
+    expect!(bytes.next() == b'P' => Err(Error::Version));
+    expect!(bytes.next() == b'/' => Err(Error::Version));
+    expect!(bytes.next() == b'1' => Err(Error::Version));
+    expect!(bytes.next() == b'.' => Err(Error::Version));
+    Ok(Status::Partial)
 }
 
 /// From [RFC 7230](https://tools.ietf.org/html/rfc7230):
 ///
 /// > ```notrust
 /// > reason-phrase  = *( HTAB / SP / VCHAR / obs-text )
 /// > HTAB           = %x09        ; horizontal tab
 /// > VCHAR          = %x21-7E     ; visible (printing) characters
@@ -504,24 +509,42 @@ fn parse_token<'a>(bytes: &mut Bytes<'a>
             }));
         } else if !is_token(b) {
             return Err(Error::Token);
         }
     }
 }
 
 #[inline]
+fn parse_uri<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
+    simd::match_uri_vectored(bytes);
+
+    loop {
+        let b = next!(bytes);
+        if b == b' ' {
+            return Ok(Status::Complete(unsafe {
+                // all bytes up till `i` must have been `is_token`.
+                str::from_utf8_unchecked(bytes.slice_skip(1))
+            }));
+        } else if !is_uri_token(b) {
+            return Err(Error::Token);
+        }
+    }
+}
+
+
+#[inline]
 fn parse_code(bytes: &mut Bytes) -> Result<u16> {
     let hundreds = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
     let tens = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
     let ones = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
 
     Ok(Status::Complete((hundreds - b'0') as u16 * 100 +
-                        (tens - b'0') as u16 * 10 +
-                        (ones - b'0') as u16))
+        (tens - b'0') as u16 * 10 +
+        (ones - b'0') as u16))
 }
 
 /// Parse a buffer of bytes as headers.
 ///
 /// The return value, if complete and successful, includes the index of the
 /// buffer that parsing stopped at, and a sliced reference to the parsed
 /// headers. The length of the slice will be equal to the number of properly
 /// parsed headers.
@@ -539,16 +562,17 @@ fn parse_code(bytes: &mut Bytes) -> Resu
 /// ```
 pub fn parse_headers<'b: 'h, 'h>(src: &'b [u8], mut dst: &'h mut [Header<'b>])
     -> Result<(usize, &'h [Header<'b>])> {
     let mut iter = Bytes::new(src);
     let pos = complete!(parse_headers_iter(&mut dst, &mut iter));
     Ok(Status::Complete((pos, dst)))
 }
 
+
 #[inline]
 fn parse_headers_iter<'a, 'b>(headers: &mut &mut [Header<'a>], bytes: &'b mut Bytes<'a>)
     -> Result<usize> {
     let mut num_headers: usize = 0;
     let mut count: usize = 0;
     let mut result = Err(Error::TooManyHeaders);
 
     {
@@ -604,17 +628,17 @@ fn parse_headers_iter<'a, 'b>(headers: &
                             break 'value;
                         }
                         break 'whitespace;
                     }
                 }
 
                 // parse value till EOL
 
-
+                simd::match_header_value_vectored(bytes);
 
                 macro_rules! check {
                     ($bytes:ident, $i:ident) => ({
                         b = $bytes.$i();
                         if !is_header_value_token(b) {
                             break 'value;
                         }
                     });
@@ -636,27 +660,41 @@ fn parse_headers_iter<'a, 'b>(headers: &
                     b = next!(bytes);
                     if !is_header_value_token(b) {
                         break 'value;
                     }
                 }
             }
 
             //found_ctl
-            if b == b'\r' {
+            let value_slice : &[u8] = if b == b'\r' {
                 expect!(bytes.next() == b'\n' => Err(Error::HeaderValue));
                 count += bytes.pos();
-                header.value = bytes.slice_skip(2);
+                // having just check that `\r\n` exists, it's safe to skip those 2 bytes
+                unsafe {
+                    bytes.slice_skip(2)
+                }
             } else if b == b'\n' {
                 count += bytes.pos();
-                header.value = bytes.slice_skip(1);
+                // having just check that `\r\n` exists, it's safe to skip 1 byte
+                unsafe {
+                    bytes.slice_skip(1)
+                }
             } else {
                 return Err(Error::HeaderValue);
+            };
+            // trim trailing whitespace in the header
+            if let Some(last_visible) = value_slice.iter().rposition(|b| *b != b' ' && *b != b'\t' ) {
+                // There is at least one non-whitespace character.
+                header.value = &value_slice[0..last_visible+1];
+            } else {
+                // There is no non-whitespace character. This can only happen when value_slice is
+                // empty.
+                header.value = value_slice;
             }
-
         }
     } // drop iter
 
     shrink(headers, num_headers);
     result
 }
 
 /// Parse a buffer of bytes as a chunk size.
@@ -667,43 +705,43 @@ fn parse_headers_iter<'a, 'b>(headers: &
 /// # Example
 ///
 /// ```
 /// let buf = b"4\r\nRust\r\n0\r\n\r\n";
 /// assert_eq!(httparse::parse_chunk_size(buf),
 ///            Ok(httparse::Status::Complete((3, 4))));
 /// ```
 pub fn parse_chunk_size(buf: &[u8])
-        -> result::Result<Status<(usize, u64)>, InvalidChunkSize> {
+    -> result::Result<Status<(usize, u64)>, InvalidChunkSize> {
     const RADIX: u64 = 16;
     let mut bytes = Bytes::new(buf);
     let mut size = 0;
     let mut in_chunk_size = true;
     let mut in_ext = false;
     let mut count = 0;
     loop {
         let b = next!(bytes);
         match b {
-            b'0'...b'9' if in_chunk_size => {
+            b'0' ... b'9' if in_chunk_size => {
                 if count > 15 {
                     return Err(InvalidChunkSize);
                 }
                 count += 1;
                 size *= RADIX;
                 size += (b - b'0') as u64;
             },
-            b'a'...b'f' if in_chunk_size => {
+            b'a' ... b'f' if in_chunk_size => {
                 if count > 15 {
                     return Err(InvalidChunkSize);
                 }
                 count += 1;
                 size *= RADIX;
                 size += (b + 10 - b'a') as u64;
             }
-            b'A'...b'F' if in_chunk_size => {
+            b'A' ... b'F' if in_chunk_size => {
                 if count > 15 {
                     return Err(InvalidChunkSize);
                 }
                 count += 1;
                 size *= RADIX;
                 size += (b + 10 - b'A') as u64;
             }
             b'\r' => {
@@ -781,31 +819,110 @@ mod tests {
             assert_eq!(req.method.unwrap(), "GET");
             assert_eq!(req.path.unwrap(), "/");
             assert_eq!(req.version.unwrap(), 1);
             assert_eq!(req.headers.len(), 0);
         }
     }
 
     req! {
+        test_request_simple_with_query_params,
+        b"GET /thing?data=a HTTP/1.1\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/thing?data=a");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 0);
+        }
+    }
+
+    req! {
+        test_request_simple_with_whatwg_query_params,
+        b"GET /thing?data=a^ HTTP/1.1\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/thing?data=a^");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 0);
+        }
+    }
+
+    req! {
         test_request_headers,
         b"GET / HTTP/1.1\r\nHost: foo.com\r\nCookie: \r\n\r\n",
         |req| {
             assert_eq!(req.method.unwrap(), "GET");
             assert_eq!(req.path.unwrap(), "/");
             assert_eq!(req.version.unwrap(), 1);
             assert_eq!(req.headers.len(), 2);
             assert_eq!(req.headers[0].name, "Host");
             assert_eq!(req.headers[0].value, b"foo.com");
             assert_eq!(req.headers[1].name, "Cookie");
             assert_eq!(req.headers[1].value, b"");
         }
     }
 
     req! {
+        test_request_headers_optional_whitespace,
+        b"GET / HTTP/1.1\r\nHost: \tfoo.com\t \r\nCookie: \t \r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 2);
+            assert_eq!(req.headers[0].name, "Host");
+            assert_eq!(req.headers[0].value, b"foo.com");
+            assert_eq!(req.headers[1].name, "Cookie");
+            assert_eq!(req.headers[1].value, b"");
+        }
+    }
+
+    req! {
+        // test the scalar parsing
+        test_request_header_value_htab_short,
+        b"GET / HTTP/1.1\r\nUser-Agent: some\tagent\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 1);
+            assert_eq!(req.headers[0].name, "User-Agent");
+            assert_eq!(req.headers[0].value, b"some\tagent");
+        }
+    }
+
+    req! {
+        // test the sse42 parsing
+        test_request_header_value_htab_med,
+        b"GET / HTTP/1.1\r\nUser-Agent: 1234567890some\tagent\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 1);
+            assert_eq!(req.headers[0].name, "User-Agent");
+            assert_eq!(req.headers[0].value, b"1234567890some\tagent");
+        }
+    }
+
+    req! {
+        // test the avx2 parsing
+        test_request_header_value_htab_long,
+        b"GET / HTTP/1.1\r\nUser-Agent: 1234567890some\t1234567890agent1234567890\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 1);
+            assert_eq!(req.headers[0].name, "User-Agent");
+            assert_eq!(req.headers[0].value, &b"1234567890some\t1234567890agent1234567890"[..]);
+        }
+    }
+
+    req! {
         test_request_headers_max,
         b"GET / HTTP/1.1\r\nA: A\r\nB: B\r\nC: C\r\nD: D\r\n\r\n",
         |req| {
             assert_eq!(req.headers.len(), NUM_OF_HEADERS);
         }
     }
 
     req! {
@@ -825,16 +942,22 @@ mod tests {
 
     req! {
         test_request_partial,
         b"GET / HTTP/1.1\r\n\r", Ok(Status::Partial),
         |_req| {}
     }
 
     req! {
+        test_request_partial_version,
+        b"GET / HTTP/1.", Ok(Status::Partial),
+        |_req| {}
+    }
+
+    req! {
         test_request_newlines,
         b"GET / HTTP/1.1\nHost: foo.bar\n\n",
         |_r| {}
     }
 
     req! {
         test_request_empty_lines_prefix,
         b"\r\n\r\nGET / HTTP/1.1\r\n\r\n",
@@ -859,16 +982,24 @@ mod tests {
 
     req! {
         test_request_with_invalid_token_delimiter,
         b"GET\n/ HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
         Err(::Error::Token),
         |_r| {}
     }
 
+
+    req! {
+        test_request_with_invalid_but_short_version,
+        b"GET / HTTP/1!",
+        Err(::Error::Version),
+        |_r| {}
+    }
+
     macro_rules! res {
         ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
             res! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
         );
         ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
         #[test]
         fn $name() {
             let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
@@ -916,16 +1047,29 @@ mod tests {
         |res| {
             assert_eq!(res.version.unwrap(), 1);
             assert_eq!(res.code.unwrap(), 200);
             assert_eq!(res.reason.unwrap(), "");
         }
     }
 
     res! {
+        test_response_reason_missing_no_space_with_headers,
+        b"HTTP/1.1 200\r\nFoo: bar\r\n\r\n",
+        |res| {
+            assert_eq!(res.version.unwrap(), 1);
+            assert_eq!(res.code.unwrap(), 200);
+            assert_eq!(res.reason.unwrap(), "");
+            assert_eq!(res.headers.len(), 1);
+            assert_eq!(res.headers[0].name, "Foo");
+            assert_eq!(res.headers[0].value, b"bar");
+        }
+    }
+
+    res! {
         test_response_reason_with_space_and_tab,
         b"HTTP/1.1 101 Switching Protocols\t\r\n\r\n",
         |res| {
             assert_eq!(res.version.unwrap(), 1);
             assert_eq!(res.code.unwrap(), 101);
             assert_eq!(res.reason.unwrap(), "Switching Protocols\t");
         }
     }
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/src/macros.rs
@@ -0,0 +1,59 @@
+///! Utility macros
+
+macro_rules! next {
+    ($bytes:ident) => ({
+        match $bytes.next() {
+            Some(b) => b,
+            None => return Ok(Status::Partial)
+        }
+    })
+}
+
+macro_rules! expect {
+    ($bytes:ident.next() == $pat:pat => $ret:expr) => {
+        expect!(next!($bytes) => $pat |? $ret)
+    };
+    ($e:expr => $pat:pat |? $ret:expr) => {
+        match $e {
+            v@$pat => v,
+            _ => return $ret
+        }
+    };
+}
+
+macro_rules! complete {
+    ($e:expr) => {
+        match try!($e) {
+            Status::Complete(v) => v,
+            Status::Partial => return Ok(Status::Partial)
+        }
+    }
+}
+
+macro_rules! byte_map {
+    ($($flag:expr,)*) => ([
+        $($flag != 0,)*
+    ])
+}
+
+macro_rules! space {
+    ($bytes:ident or $err:expr) => ({
+        expect!($bytes.next() == b' ' => Err($err));
+        $bytes.slice();
+    })
+}
+
+macro_rules! newline {
+    ($bytes:ident) => ({
+        match next!($bytes) {
+            b'\r' => {
+                expect!($bytes.next() == b'\n' => Err(Error::NewLine));
+                $bytes.slice();
+            },
+            b'\n' => {
+                $bytes.slice();
+            },
+            _ => return Err(Error::NewLine)
+        }
+    })
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/src/simd/avx2.rs
@@ -0,0 +1,116 @@
+use ::iter::Bytes;
+
+pub enum Scan {
+    /// Returned when an implementation finds a noteworthy token.
+    Found,
+    /// Returned when an implementation couldn't keep running because the input was too short.
+    TooShort,
+}
+
+
+pub unsafe fn parse_uri_batch_32<'a>(bytes: &mut Bytes<'a>) -> Scan {
+    while bytes.as_ref().len() >= 32 {
+        let advance = match_url_char_32_avx(bytes.as_ref());
+        bytes.advance(advance);
+
+        if advance != 32 {
+            return Scan::Found;
+        }
+    }
+    Scan::TooShort
+}
+
+#[cfg(target_arch = "x86_64")]
+#[target_feature(enable = "avx2")]
+#[inline]
+#[allow(non_snake_case, overflowing_literals)]
+unsafe fn match_url_char_32_avx(buf: &[u8]) -> usize {
+    debug_assert!(buf.len() >= 32);
+
+    /*
+    #[cfg(target_arch = "x86")]
+    use core::arch::x86::*;
+    #[cfg(target_arch = "x86_64")]
+    */
+    use core::arch::x86_64::*;
+
+    let ptr = buf.as_ptr();
+
+    let LSH: __m256i = _mm256_set1_epi8(0x0f);
+    let URI: __m256i = _mm256_setr_epi8(
+        0xb8, 0xfc, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
+        0xfc, 0xfc, 0xfc, 0x7c, 0x54, 0x7c, 0xd4, 0x7c,
+        0xb8, 0xfc, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
+        0xfc, 0xfc, 0xfc, 0x7c, 0x54, 0x7c, 0xd4, 0x7c,
+    );
+    let ARF: __m256i = _mm256_setr_epi8(
+        0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    );
+
+    let data = _mm256_lddqu_si256(ptr as *const _);
+    let rbms = _mm256_shuffle_epi8(URI, data);
+    let cols = _mm256_and_si256(LSH, _mm256_srli_epi16(data, 4));
+    let bits = _mm256_and_si256(_mm256_shuffle_epi8(ARF, cols), rbms);
+
+    let v = _mm256_cmpeq_epi8(bits, _mm256_setzero_si256());
+    let r = 0xffffffff_00000000 | _mm256_movemask_epi8(v) as u64;
+
+    _tzcnt_u64(r) as usize
+}
+
+#[cfg(target_arch = "x86")]
+unsafe fn match_url_char_32_avx(_: &[u8]) -> usize {
+    unreachable!("AVX2 detection should be disabled for x86");
+}
+
+pub unsafe fn match_header_value_batch_32(bytes: &mut Bytes) -> Scan {
+    while bytes.as_ref().len() >= 32 {
+        let advance = match_header_value_char_32_avx(bytes.as_ref());
+        bytes.advance(advance);
+
+        if advance != 32 {
+            return Scan::Found;
+        }
+    }
+    Scan::TooShort
+}
+
+#[cfg(target_arch = "x86_64")]
+#[target_feature(enable = "avx2")]
+#[inline]
+#[allow(non_snake_case)]
+unsafe fn match_header_value_char_32_avx(buf: &[u8]) -> usize {
+    debug_assert!(buf.len() >= 32);
+
+    /*
+    #[cfg(target_arch = "x86")]
+    use core::arch::x86::*;
+    #[cfg(target_arch = "x86_64")]
+    */
+    use core::arch::x86_64::*;
+
+    let ptr = buf.as_ptr();
+
+    // %x09 %x20-%x7e %x80-%xff
+    let TAB: __m256i = _mm256_set1_epi8(0x09);
+    let DEL: __m256i = _mm256_set1_epi8(0x7f);
+    let LOW: __m256i = _mm256_set1_epi8(0x1f);
+
+    let dat = _mm256_lddqu_si256(ptr as *const _);
+    let low = _mm256_cmpgt_epi8(dat, LOW);
+    let tab = _mm256_cmpeq_epi8(dat, TAB);
+    let del = _mm256_cmpeq_epi8(dat, DEL);
+    let bit = _mm256_andnot_si256(del, _mm256_or_si256(low, tab));
+    let rev = _mm256_cmpeq_epi8(bit, _mm256_setzero_si256());
+    let res = 0xffffffff_00000000 | _mm256_movemask_epi8(rev) as u64;
+
+    _tzcnt_u64(res) as usize
+}
+
+#[cfg(target_arch = "x86")]
+unsafe fn match_header_value_char_32_avx(_: &[u8]) -> usize {
+    unreachable!("AVX2 detection should be disabled for x86");
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/src/simd/fallback.rs
@@ -0,0 +1,8 @@
+use ::iter::Bytes;
+
+// Fallbacks that do nothing...
+
+#[inline(always)]
+pub fn match_uri_vectored(_: &mut Bytes) {}
+#[inline(always)]
+pub fn match_header_value_vectored(_: &mut Bytes) {}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/src/simd/mod.rs
@@ -0,0 +1,238 @@
+#[cfg(not(all(
+    httparse_simd,
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+)))]
+mod fallback;
+
+#[cfg(not(all(
+    httparse_simd,
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+)))]
+pub use self::fallback::*;
+
+#[cfg(all(
+    httparse_simd,
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+mod sse42;
+
+#[cfg(all(
+    httparse_simd,
+    any(
+        httparse_simd_target_feature_avx2,
+        not(httparse_simd_target_feature_sse42),
+    ),
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+mod avx2;
+
+#[cfg(all(
+    httparse_simd,
+    not(any(
+        httparse_simd_target_feature_sse42,
+        httparse_simd_target_feature_avx2,
+    )),
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+mod runtime {
+    //! Runtime detection of simd features. Used when the build script
+    //! doesn't notice any target features at build time.
+    //!
+    //! While `is_x86_feature_detected!` has it's own caching built-in,
+    //! at least in 1.27.0, the functions don't inline, leaving using it
+    //! actually *slower* than just using the scalar fallback.
+
+    use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+
+    static FEATURE: AtomicUsize = ATOMIC_USIZE_INIT;
+
+    const INIT: usize = 0;
+    const SSE_42: usize = 1;
+    const AVX_2: usize = 2;
+    const AVX_2_AND_SSE_42: usize = 3;
+    const NONE: usize = ::core::usize::MAX;
+
+    fn detect() -> usize {
+        let feat = FEATURE.load(Ordering::Relaxed);
+        if feat == INIT {
+            if cfg!(target_arch = "x86_64") && is_x86_feature_detected!("avx2") {
+                if is_x86_feature_detected!("sse4.2") {
+                    FEATURE.store(AVX_2_AND_SSE_42, Ordering::Relaxed);
+                    return AVX_2_AND_SSE_42;
+                } else {
+                    FEATURE.store(AVX_2, Ordering::Relaxed);
+                    return AVX_2;
+                }
+            } else if is_x86_feature_detected!("sse4.2") {
+                FEATURE.store(SSE_42, Ordering::Relaxed);
+                return SSE_42;
+            } else {
+                FEATURE.store(NONE, Ordering::Relaxed);
+            }
+        }
+        feat
+    }
+
+    pub fn match_uri_vectored(bytes: &mut ::Bytes) {
+        unsafe {
+            match detect() {
+                SSE_42 => super::sse42::parse_uri_batch_16(bytes),
+                AVX_2 => { super::avx2::parse_uri_batch_32(bytes); },
+                AVX_2_AND_SSE_42 => {
+                    if let super::avx2::Scan::Found = super::avx2::parse_uri_batch_32(bytes) {
+                        return;
+                    }
+                    super::sse42::parse_uri_batch_16(bytes)
+                },
+                _ => ()
+            }
+        }
+
+        // else do nothing
+    }
+
+    pub fn match_header_value_vectored(bytes: &mut ::Bytes) {
+        unsafe {
+            match detect() {
+                SSE_42 => super::sse42::match_header_value_batch_16(bytes),
+                AVX_2 => { super::avx2::match_header_value_batch_32(bytes); },
+                AVX_2_AND_SSE_42 => {
+                    if let super::avx2::Scan::Found = super::avx2::match_header_value_batch_32(bytes) {
+                        return;
+                    }
+                    super::sse42::match_header_value_batch_16(bytes)
+                },
+                _ => ()
+            }
+        }
+
+        // else do nothing
+    }
+}
+
+#[cfg(all(
+    httparse_simd,
+    not(any(
+        httparse_simd_target_feature_sse42,
+        httparse_simd_target_feature_avx2,
+    )),
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+pub use self::runtime::*;
+
+#[cfg(all(
+    httparse_simd,
+    httparse_simd_target_feature_sse42,
+    not(httparse_simd_target_feature_avx2),
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+mod sse42_compile_time {
+    pub fn match_uri_vectored(bytes: &mut ::Bytes) {
+        if is_x86_feature_detected!("sse4.2") {
+            unsafe {
+                super::sse42::parse_uri_batch_16(bytes);
+            }
+        }
+
+        // else do nothing
+    }
+
+    pub fn match_header_value_vectored(bytes: &mut ::Bytes) {
+        if is_x86_feature_detected!("sse4.2") {
+            unsafe {
+                super::sse42::match_header_value_batch_16(bytes);
+            }
+        }
+
+        // else do nothing
+    }
+}
+
+#[cfg(all(
+    httparse_simd,
+    httparse_simd_target_feature_sse42,
+    not(httparse_simd_target_feature_avx2),
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+pub use self::sse42_compile_time::*;
+
+#[cfg(all(
+    httparse_simd,
+    httparse_simd_target_feature_avx2,
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+mod avx2_compile_time {
+    pub fn match_uri_vectored(bytes: &mut ::Bytes) {
+        // do both, since avx2 only works when bytes.len() >= 32
+        if cfg!(target_arch = "x86_64") && is_x86_feature_detected!("avx2") {
+            unsafe {
+                super::avx2::parse_uri_batch_32(bytes);
+            }
+
+        } 
+        if is_x86_feature_detected!("sse4.2") {
+            unsafe {
+                super::sse42::parse_uri_batch_16(bytes);
+            }
+        }
+
+        // else do nothing
+    }
+
+    pub fn match_header_value_vectored(bytes: &mut ::Bytes) {
+        // do both, since avx2 only works when bytes.len() >= 32
+        if cfg!(target_arch = "x86_64") && is_x86_feature_detected!("avx2") {
+            let scanned = unsafe {
+                super::avx2::match_header_value_batch_32(bytes)
+            };
+
+            if let super::avx2::Scan::Found = scanned {
+                return;
+            }
+        }
+        if is_x86_feature_detected!("sse4.2") {
+            unsafe {
+                super::sse42::match_header_value_batch_16(bytes);
+            }
+        }
+
+        // else do nothing
+    }
+}
+
+#[cfg(all(
+    httparse_simd,
+    httparse_simd_target_feature_avx2,
+    any(
+        target_arch = "x86",
+        target_arch = "x86_64",
+    ),
+))]
+pub use self::avx2_compile_time::*;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/src/simd/sse42.rs
@@ -0,0 +1,84 @@
+use ::iter::Bytes;
+
+pub unsafe fn parse_uri_batch_16<'a>(bytes: &mut Bytes<'a>) {
+    while bytes.as_ref().len() >= 16 {
+        let advance = match_url_char_16_sse(bytes.as_ref());
+        bytes.advance(advance);
+
+        if advance != 16 {
+            break;
+        }
+    }
+}
+
+#[target_feature(enable = "sse4.2")]
+#[allow(non_snake_case, overflowing_literals)]
+unsafe fn match_url_char_16_sse(buf: &[u8]) -> usize {
+    debug_assert!(buf.len() >= 16);
+
+    #[cfg(target_arch = "x86")]
+    use core::arch::x86::*;
+    #[cfg(target_arch = "x86_64")]
+    use core::arch::x86_64::*;
+
+    let ptr = buf.as_ptr();
+
+    let LSH: __m128i = _mm_set1_epi8(0x0f);
+    let URI: __m128i = _mm_setr_epi8(
+        0xb8, 0xfc, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc,
+        0xfc, 0xfc, 0xfc, 0x7c, 0x54, 0x7c, 0xd4, 0x7c,
+    );
+    let ARF: __m128i = _mm_setr_epi8(
+        0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    );
+
+    let data = _mm_lddqu_si128(ptr as *const _);
+    let rbms = _mm_shuffle_epi8(URI, data);
+    let cols = _mm_and_si128(LSH, _mm_srli_epi16(data, 4));
+    let bits = _mm_and_si128(_mm_shuffle_epi8(ARF, cols), rbms);
+
+    let v = _mm_cmpeq_epi8(bits, _mm_setzero_si128());
+    let r = 0xffff_0000 | _mm_movemask_epi8(v) as u32;
+
+    _tzcnt_u32(r) as usize
+}
+
+pub unsafe fn match_header_value_batch_16(bytes: &mut Bytes) {
+    while bytes.as_ref().len() >= 16 {
+        let advance = match_header_value_char_16_sse(bytes.as_ref());
+        bytes.advance(advance);
+
+       if advance != 16 {
+            break;
+       }
+    }
+}
+
+#[target_feature(enable = "sse4.2")]
+#[allow(non_snake_case)]
+unsafe fn match_header_value_char_16_sse(buf: &[u8]) -> usize {
+    debug_assert!(buf.len() >= 16);
+
+    #[cfg(target_arch = "x86")]
+    use core::arch::x86::*;
+    #[cfg(target_arch = "x86_64")]
+    use core::arch::x86_64::*;
+
+    let ptr = buf.as_ptr();
+
+    // %x09 %x20-%x7e %x80-%xff
+    let TAB: __m128i = _mm_set1_epi8(0x09);
+    let DEL: __m128i = _mm_set1_epi8(0x7f);
+    let LOW: __m128i = _mm_set1_epi8(0x1f);
+
+    let dat = _mm_lddqu_si128(ptr as *const _);
+    let low = _mm_cmpgt_epi8(dat, LOW);
+    let tab = _mm_cmpeq_epi8(dat, TAB);
+    let del = _mm_cmpeq_epi8(dat, DEL);
+    let bit = _mm_andnot_si128(del, _mm_or_si128(low, tab));
+    let rev = _mm_cmpeq_epi8(bit, _mm_setzero_si128());
+    let res = 0xffff_0000 | _mm_movemask_epi8(rev) as u32;
+
+    _tzcnt_u32(res) as usize
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/httparse/tests/uri.rs
@@ -0,0 +1,3677 @@
+extern crate httparse;
+
+use httparse::{Error, Request, Status, EMPTY_HEADER};
+
+const NUM_OF_HEADERS: usize = 4;
+
+macro_rules! req {
+    ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
+        req! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
+    );
+    ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
+    #[test]
+    fn $name() {
+        let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
+        let mut req = Request::new(&mut headers[..]);
+        let status = req.parse($buf.as_ref());
+        assert_eq!(status, $len);
+        closure(req);
+
+        fn closure($arg: Request) {
+            $body
+        }
+    }
+    )
+}
+
+req! {
+    urltest_001,
+    b"GET /bar;par?b HTTP/1.1\r\nHost: foo\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/bar;par?b");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo");
+    }
+}
+
+
+req! {
+    urltest_002,
+    b"GET /x HTTP/1.1\r\nHost: test\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/x");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"test");
+    }
+}
+
+
+req! {
+    urltest_003,
+    b"GET /x HTTP/1.1\r\nHost: test\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/x");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"test");
+    }
+}
+
+
+req! {
+    urltest_004,
+    b"GET /foo/foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/foo.com");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_005,
+    b"GET /foo/:foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:foo.com");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_006,
+    b"GET /foo/foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/foo.com");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_007,
+    b"GET  foo.com HTTP/1.1\r\nHost: \r\n\r\n",
+    Err(Error::Version),
+    |_r| {}
+}
+
+
+req! {
+    urltest_008,
+    b"GET /%20b%20?%20d%20 HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/%20b%20?%20d%20");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_009,
+    b"GET x x HTTP/1.1\r\nHost: \r\n\r\n",
+    Err(Error::Version),
+    |_r| {}
+}
+
+
+req! {
+    urltest_010,
+    b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_011,
+    b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_012,
+    b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_013,
+    b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_014,
+    b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"f");
+    }
+}
+
+
+req! {
+    urltest_015,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_016,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_017,
+    b"GET /foo/:foo.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:foo.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_018,
+    b"GET /foo/:foo.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:foo.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_019,
+    b"GET /foo/: HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_020,
+    b"GET /foo/:a HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:a");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_021,
+    b"GET /foo/:/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_022,
+    b"GET /foo/:/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_023,
+    b"GET /foo/: HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_024,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_025,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_026,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_027,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_028,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_029,
+    b"GET /foo/:23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:23");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_030,
+    b"GET /:23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/:23");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_031,
+    b"GET /foo/:: HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/::");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_032,
+    b"GET /foo/::23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/::23");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_033,
+    b"GET /d HTTP/1.1\r\nHost: c\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/d");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"c");
+    }
+}
+
+
+req! {
+    urltest_034,
+    b"GET /foo/:@c:29 HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/:@c:29");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_035,
+    b"GET //@ HTTP/1.1\r\nHost: foo.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "//@");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo.com");
+    }
+}
+
+
+req! {
+    urltest_036,
+    b"GET /b:c/d@foo.com/ HTTP/1.1\r\nHost: a\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/b:c/d@foo.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"a");
+    }
+}
+
+
+req! {
+    urltest_037,
+    b"GET /bar.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/bar.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_038,
+    b"GET /////// HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "///////");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_039,
+    b"GET ///////bar.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "///////bar.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_040,
+    b"GET //:///// HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "//://///");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_041,
+    b"GET /foo HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_042,
+    b"GET /bar HTTP/1.1\r\nHost: foo\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo");
+    }
+}
+
+
+req! {
+    urltest_043,
+    b"GET /path;a??e HTTP/1.1\r\nHost: foo\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/path;a??e");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo");
+    }
+}
+
+
+req! {
+    urltest_044,
+    b"GET /abcd?efgh?ijkl HTTP/1.1\r\nHost: foo\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/abcd?efgh?ijkl");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo");
+    }
+}
+
+
+req! {
+    urltest_045,
+    b"GET /abcd HTTP/1.1\r\nHost: foo\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/abcd");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"foo");
+    }
+}
+
+
+req! {
+    urltest_046,
+    b"GET /foo/[61:24:74]:98 HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/[61:24:74]:98");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_047,
+    b"GET /foo/[61:27]/:foo HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/[61:27]/:foo");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_048,
+    b"GET /example.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_049,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_050,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_051,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_052,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_053,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_054,
+    b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_055,
+    b"GET /foo/example.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_056,
+    b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_057,
+    b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_058,
+    b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_059,
+    b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_060,
+    b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "example.com/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_061,
+    b"GET /a/b/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/a/b/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_062,
+    b"GET /a/%20/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/a/%20/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_063,
+    b"GET /a%2fc HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/a%2fc");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_064,
+    b"GET /a/%2f/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/a/%2f/c");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_065,
+    b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.org");
+    }
+}
+
+
+req! {
+    urltest_066,
+    b"GET text/html,test HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "text/html,test");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_067,
+    b"GET 1234567890 HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "1234567890");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_068,
+    b"GET /c:/foo/bar.html HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c:/foo/bar.html");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_069,
+    b"GET /c:////foo/bar.html HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/c:////foo/bar.html");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_070,
+    b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/C:/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_071,
+    b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/C:/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_072,
+    b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/C:/foo/bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_073,
+    b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/file");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"server");
+    }
+}
+
+
+req! {
+    urltest_074,
+    b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/file");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"server");
+    }
+}
+
+
+req! {
+    urltest_075,
+    b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/file");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"server");
+    }
+}
+
+
+req! {
+    urltest_076,
+    b"GET /foo/bar.txt HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/bar.txt");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_077,
+    b"GET /home/me HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/home/me");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_078,
+    b"GET /test HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/test");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_079,
+    b"GET /test HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/test");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_080,
+    b"GET /tmp/mock/test HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/tmp/mock/test");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_081,
+    b"GET /tmp/mock/test HTTP/1.1\r\nHost: \r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/tmp/mock/test");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"");
+    }
+}
+
+
+req! {
+    urltest_082,
+    b"GET /foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_083,
+    b"GET /.foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/.foo");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_084,
+    b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_085,
+    b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_086,
+    b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_087,
+    b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_088,
+    b"GET /foo/..bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/..bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_089,
+    b"GET /foo/ton HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/ton");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_090,
+    b"GET /a HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/a");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_091,
+    b"GET /ton HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/ton");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_092,
+    b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_093,
+    b"GET /foo/%2e%2 HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/foo/%2e%2");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {
+    urltest_094,
+    b"GET /%2e.bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
+    |req| {
+        assert_eq!(req.method.unwrap(), "GET");
+        assert_eq!(req.path.unwrap(), "/%2e.bar");
+        assert_eq!(req.version.unwrap(), 1);
+        assert_eq!(req.headers.len(), 1);
+        assert_eq!(req.headers[0].name, "Host");
+        assert_eq!(req.headers[0].value, b"example.com");
+    }
+}
+
+
+req! {